DataInputStream

Data input stream implements gio.input_stream.InputStream and includes functions for reading structured data directly from a binary input stream.

class DataInputStream : BufferedInputStream {}

Constructors

this
this(gio.input_stream.InputStream baseStream)

Creates a new data input stream for the base_stream.

Members

Functions

getByteOrder
gio.types.DataStreamByteOrder getByteOrder()

Gets the byte order for the data input stream.

getNewlineType
gio.types.DataStreamNewlineType getNewlineType()

Gets the current newline type for the stream.

readByteData
ubyte readByteData(gio.cancellable.Cancellable cancellable)

Reads an unsigned 8-bit/1-byte value from stream.

readInt16
short readInt16(gio.cancellable.Cancellable cancellable)

Reads a 16-bit/2-byte value from stream.

readInt32
int readInt32(gio.cancellable.Cancellable cancellable)

Reads a signed 32-bit/4-byte value from stream.

readInt64
long readInt64(gio.cancellable.Cancellable cancellable)

Reads a 64-bit/8-byte value from stream.

readLineAsync
void readLineAsync(int ioPriority, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

The asynchronous version of gio.data_input_stream.DataInputStream.readLine. It is an error to have two outstanding calls to this function.

readLineFinishUtf8
string readLineFinishUtf8(gio.async_result.AsyncResult result, size_t length)

Finish an asynchronous call started by gio.data_input_stream.DataInputStream.readLineAsync.

readLineUtf8
string readLineUtf8(size_t length, gio.cancellable.Cancellable cancellable)

Reads a UTF-8 encoded line from the data input stream.

readUint16
ushort readUint16(gio.cancellable.Cancellable cancellable)

Reads an unsigned 16-bit/2-byte value from stream.

readUint32
uint readUint32(gio.cancellable.Cancellable cancellable)

Reads an unsigned 32-bit/4-byte value from stream.

readUint64
ulong readUint64(gio.cancellable.Cancellable cancellable)

Reads an unsigned 64-bit/8-byte value from stream.

readUntil
string readUntil(string stopChars, size_t length, gio.cancellable.Cancellable cancellable)

Reads a string from the data input stream, up to the first occurrence of any of the stop characters.

readUntilAsync
void readUntilAsync(string stopChars, int ioPriority, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

The asynchronous version of gio.data_input_stream.DataInputStream.readUntil. It is an error to have two outstanding calls to this function.

readUntilFinish
string readUntilFinish(gio.async_result.AsyncResult result, size_t length)

Finish an asynchronous call started by gio.data_input_stream.DataInputStream.readUntilAsync.

readUpto
string readUpto(string stopChars, ptrdiff_t stopCharsLen, size_t length, gio.cancellable.Cancellable cancellable)

Reads a string from the data input stream, up to the first occurrence of any of the stop characters.

readUptoAsync
void readUptoAsync(string stopChars, ptrdiff_t stopCharsLen, int ioPriority, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

The asynchronous version of gio.data_input_stream.DataInputStream.readUpto. It is an error to have two outstanding calls to this function.

readUptoFinish
string readUptoFinish(gio.async_result.AsyncResult result, size_t length)

Finish an asynchronous call started by gio.data_input_stream.DataInputStream.readUptoAsync.

setByteOrder
void setByteOrder(gio.types.DataStreamByteOrder order)

This function sets the byte order for the given stream. All subsequent reads from the stream will be read in the given order.

setNewlineType
void setNewlineType(gio.types.DataStreamNewlineType type)

Sets the newline type for the stream.

Inherited Members

From BufferedInputStream

newSized
gio.buffered_input_stream.BufferedInputStream newSized(gio.input_stream.InputStream baseStream, size_t size)

Creates a new #GBufferedInputStream from the given base_stream, with a buffer set to size.

fill
ptrdiff_t fill(ptrdiff_t count, gio.cancellable.Cancellable cancellable)

Tries to read count bytes from the stream into the buffer. Will block during this read.

fillAsync
void fillAsync(ptrdiff_t count, int ioPriority, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Reads data into stream's buffer asynchronously, up to count size. io_priority can be used to prioritize reads. For the synchronous version of this function, see gio.buffered_input_stream.BufferedInputStream.fill.

fillFinish
ptrdiff_t fillFinish(gio.async_result.AsyncResult result)

Finishes an asynchronous read.

getAvailable
size_t getAvailable()

Gets the size of the available data within the stream.

getBufferSize
size_t getBufferSize()

Gets the size of the input buffer.

peek
size_t peek(ubyte[] buffer, size_t offset)

Peeks in the buffer, copying data of size count into buffer, offset offset bytes.

peekBuffer
ubyte[] peekBuffer()

Returns the buffer with the currently available bytes. The returned buffer must not be modified and will become invalid when reading from the stream or filling the buffer.

readByte
int readByte(gio.cancellable.Cancellable cancellable)

Tries to read a single byte from the stream or the buffer. Will block during this read.

setBufferSize
void setBufferSize(size_t size)

Sets the size of the internal buffer of stream to size, or to the size of the contents of the buffer. The buffer can never be resized smaller than its current contents.