IDataStreamOps

Description

interface Tinman.Core.IO.Streams.IDataStreamOps

Derived from

ITextStreamFactory

Extended by

IDataStream

Defines common operations for IDataStream objects.

Public / Methods

Background


[OwnerReturn] [OwnerThis]
public method Background → (2)

bufferSize opt : int32 = 65536

[>0]
The buffer size, in bytes.

bufferCount opt : int32 = 16

[>0]
The buffer count.

returns → IDataStream

The sequential read-only data stream.

Uses a background thread to prefetch data from this data stream.

If this data stream is already being prefetched in a background thread, this method may return this.

The resulting data stream does not support seeking (i.e. IDataStream.CanSeek returns false) and it will be in read-only ( ICanReadWrite.CanRead) mode.

IOException

If this stream does not support reading or if some other error has occurred, for example an I/O error while loading small data stream into memory up-front.

Buffer


[OwnerReturn] [OwnerThis]
public method Buffer → (1)

bufferSize opt : int32 = 65536

[>0]
The buffer size, in bytes.

returns → IDataStream

The buffered data stream.

Wraps this data stream in a buffered stream.

If this data stream is already buffered in memory, this method may return this.

An implementation may choose to perform optimizations, for example loading the whole stream content into memory for small amounts of data.

If both read and write operations are going to be used on the returned stream, seeking must be supported by this stream (see IDataStream.CanSeek).

IOException

If an I/O error has occurred.

Read​To​End


[OwnerReturn] [OwnerThis]
public method ReadToEnd → ()

returns → ByteBuffer

The read bytes.

Reads all remaining data from this stream and disposes it.

IOException

If an I/O error has occurred.

To​File


[OwnerReturn] [OwnerThis]
public method ToFile → (1)

temporary opt : bool = true

If the data stream bytes must be copied to a temporary file:
true will use FileFlags.Temporary,
false will use FileFlags.Create.
Otherwise, this parameter will be ignored.

returns → IFile

The data file.

Converts this data stream into a random-access file.

It may be necessary to copy the data stream bytes to a temporary file.

IOException

If an I/O error has occurred.