Stream

A stream that can either be read from or written to.

This is the base class of all stream related classes.

Note: Stream objects should always be nothrow; use error codes as provided by StreamError to specify failure states.

Members

Functions

close
void close()

Closes the stream.

flush
bool flush()

Clears all buffers of the stream and causes data to be written to the underlying device.

read
ptrdiff_t read(ubyte[] buffer)

Reads bytes from the specified stream in to the specified buffer

seek
long seek(ptrdiff_t offset, SeekOrigin origin)

Sets the reading position within the stream

write
ptrdiff_t write(ubyte[] buffer)

Writes bytes from the specified buffer in to the stream

Properties

canFlush
bool canFlush [@property getter]

Whether the stream can be flushed to disk.

canRead
bool canRead [@property getter]

Whether the stream can be read from.

canSeek
bool canSeek [@property getter]

Whether the stream can be seeked.

canTimeout
bool canTimeout [@property getter]

Whether the stream can timeout during operations.

canWrite
bool canWrite [@property getter]

Whether the stream can be written to.

length
ptrdiff_t length [@property getter]

Length of the stream.

readTimeout
int readTimeout [@property getter]

Timeout in milliseconds before a read operation will fail.

tell
ptrdiff_t tell [@property getter]

Position in stream

writeTimeout
int writeTimeout [@property getter]

Timeout in milliseconds before a write operation will fail.

Meta