-
-
Notifications
You must be signed in to change notification settings - Fork 33
dlib.core.stream
Timur Gafarov edited this page Apr 26, 2017
·
8 revisions
Binary I/O stream interfaces.
-
StreamPos
- an alias tostd.stdint.uint64_t
. -
StreamSize
- an alias tostd.stdint.uint64_t
. -
StreamOffset
- an alias tostd.stdint.int64_t
.
An exception which is throwed on stream errors.
Represents a stream container that knows the size of a stream and allows to change byte position within the stream.
-
StreamPos getPosition()
- returns current position. -
bool setPosition(StreamPos pos)
- sets current position to pos. Returnstrue
on success,false
on failure. -
StreamSize size()
- returns the size of a stream in bytes. -
final StreamPos position(StreamPos pos)
- sets current position and returns it. ThrowsSeekException
on failure. -
final StreamPos position()
- returns current position. -
final StreamPos seek(StreamOffset amount)
- relatively changes position.amount
defines an offset from the current position (can be negative). ThrowsSeekException
on failure.
A parent interface for all stream types.
-
void close()
- closes the stream. Closed stream cannot be read or written any more. -
bool seekable()
- returnstrue
if it is legal to useSeekable
functionality on this stream.
A stream that allows to read data from it. Reading any data implies position advance by corresponding number of bytes.
-
bool readable()
- returnstrue
if there are any data to read.false
means end of the stream. -
size_t readBytes(void* buffer, size_t count)
- tries to readcount
bytes from stream and stores them in memory pointing bybuffer
. Returns number of bytes actually read. -
final bool fillArray(T)(T[] array)
- tries to fill an array with raw data from stream. Returnstrue
if the array was filled,false
otherwise. -
final bool readLE(T)(T* value)
- reads little-endian integer, converts to native-endian and stores invalue
. -
final bool readBE(T)(T* value)
- reads big-endian integer, converts to native-endian and stores invalue
.
void flush()
bool writeable()
size_t writeBytes(const void* buffer, size_t count)
final bool writeArray(T)(const T[] array)
final bool writeStringz(string text)
final bool writeLE(T)(const T value)
final bool writeBE(T)(const T value)
this()
this(ubyte[] data, size_t size)
this(ubyte[] data)
StreamSize copyFromTo(InputStream input, OutputStream output)