DataInputStream

Data input stream implements #GInputStream and includes functions for reading structured data directly from a binary input stream.

class DataInputStream : BufferedInputStream {}

Constructors

this
this(GDataInputStream* gDataInputStream, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(InputStream baseStream)

Creates a new data input stream for the @base_stream.

Members

Functions

getByteOrder
GDataStreamByteOrder getByteOrder()

Gets the byte order for the data input stream.

getDataInputStreamStruct
GDataInputStream* getDataInputStreamStruct()

Get the main Gtk struct

getNewlineType
GDataStreamNewlineType getNewlineType()

Gets the current newline type for the @stream.

getStruct
void* getStruct()

the main Gtk struct as a void*

readInt16
short readInt16(Cancellable cancellable)

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

readInt32
int readInt32(Cancellable cancellable)

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

readInt64
long readInt64(Cancellable cancellable)

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

readLine
string readLine(size_t length, Cancellable cancellable)

Reads a line from the data input stream. Note that no encoding checks or conversion is performed; the input is not guaranteed to be UTF-8, and may in fact have embedded NUL characters.

readLineAsync
void readLineAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

The asynchronous version of g_data_input_stream_read_line(). It is an error to have two outstanding calls to this function.

readLineFinish
string readLineFinish(AsyncResultIF result, size_t length)

Finish an asynchronous call started by g_data_input_stream_read_line_async(). Note the warning about string encoding in g_data_input_stream_read_line() applies here as well.

readLineFinishUtf8
string readLineFinishUtf8(AsyncResultIF result, size_t length)

Finish an asynchronous call started by g_data_input_stream_read_line_async().

readLineUtf8
string readLineUtf8(size_t length, Cancellable cancellable)

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

readUint16
ushort readUint16(Cancellable cancellable)

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

readUint32
uint readUint32(Cancellable cancellable)

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

readUint64
ulong readUint64(Cancellable cancellable)

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

readUntil
string readUntil(string stopChars, size_t length, 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, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

The asynchronous version of g_data_input_stream_read_until(). It is an error to have two outstanding calls to this function.

readUntilFinish
string readUntilFinish(AsyncResultIF result, size_t length)

Finish an asynchronous call started by g_data_input_stream_read_until_async().

readUpto
string readUpto(string stopChars, ptrdiff_t stopCharsLen, size_t length, 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, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

The asynchronous version of g_data_input_stream_read_upto(). It is an error to have two outstanding calls to this function.

readUptoFinish
string readUptoFinish(AsyncResultIF result, size_t length)

Finish an asynchronous call started by g_data_input_stream_read_upto_async().

setByteOrder
void setByteOrder(GDataStreamByteOrder 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(GDataStreamNewlineType type)

Sets the newline type for the @stream.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

getType
GType getType()

Variables

gDataInputStream
GDataInputStream* gDataInputStream;

the main Gtk struct

Inherited Members

From BufferedInputStream

gBufferedInputStream
GBufferedInputStream* gBufferedInputStream;

the main Gtk struct

getBufferedInputStreamStruct
GBufferedInputStream* getBufferedInputStreamStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
__anonymous
mixin SeekableT!(GBufferedInputStream)
Undocumented in source.
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.

getType
GType getType()
fill
ptrdiff_t fill(ptrdiff_t count, 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, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

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 g_buffered_input_stream_fill().

fillFinish
ptrdiff_t fillFinish(AsyncResultIF 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.

readByte
int readByte(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.

Meta