IStream

Description

interface Tinman.Core.IO.Streams.IStream

Base interface for streams.

All non-abstract implementations of IStream that support writing are required to call Finish when they are about to get disposed (e.g. first statement of Disposable.DisposeResources). If an error happens during that call, it should be logged, instead of being thrown as an exception (see StreamBase.FinishLogError). As best practice, code that writes to a stream should call the Finish method before disposing the stream. Then the code will be able to handle a thrown IOException properly.

Public / Methods

Finish


public method Finish → ()

Flushes the stream and tells it that no more data will be written to it.

After calling this method, IsFinished will return true and ICanWrite.CanWrite will return false, i.e. trying to write more data will cause an IOException to be thrown. Aggregated streams will not be finished, so data may still be written to them.

IOException

If an I/O error has occurred.

Public / Attributes

Is​Finished


public attribute IsFinished → (get)

value : bool

true if the stream writes have finished, false if not.

Has writing to this stream finished?

See also

IStream.Finish