IO Streams
License
Boost License 1.0.
Authors
Jason White

T[]  readExactly(Stream, T)(auto ref Stream stream, T[] buf) if (isSource!Stream);

Reads exactly the number of bytes requested from the stream. Throws an exception if it cannot be done. Returns the filled buffer.

Note that, because it can potentially take multiple system calls to complete the read, the read is not guaranteed to be atomic with respect to other reads.

Throws
ReadException if the given buffer cannot be completely filled.

void  writeExactly(Stream, T)(auto ref Stream stream, in T[] buf) if (isSink!Stream);

Writes exactly the given buffer and no less. Throws an exception if it cannot be done.

Note that, because it can potentially take multiple system calls to complete the write, the write is not guaranteed to be atomic with respect to other writes.

Throws
WriteException if the given buffer cannot be completely written.

T[]  readAll(T = ubyte, Stream)(auto ref Stream stream, long upTo = (long).max) if (isSource!Stream && isSeekable!Stream);

Reads the rest of the stream.


@property void  position(Stream)(auto ref Stream stream, long offset) if (isSeekable!Stream);

Set the  position (in bytes) of a stream.


@property auto  position(Stream)(auto ref Stream stream) if (isSeekable!Stream);

Gets the  position (in bytes) of a stream.


long  skip(Stream)(auto ref Stream stream, long offset) if (isSeekable!Stream);

Skip the specified number of bytes forward or backward.

Returns
The position (in bytes) in the stream after the seek.