GObject.Object
Gio.InputStream
Gio.FilterInputStream
Gio.BufferedInputStream
Gio.DataInputStream
Import line: | Gio = imports.gi.Gio; |
GIR File: | Gio-2.0.gir |
C documentation: | GDataInputStream |
Class : | DataInputStream |
Extends: | Gio.BufferedInputStream |
Properties | Defined By | |
---|---|---|
base_stream : Gio.InputStream
|
Gio.FilterInputStream | |
buffer_size : guint32
|
Gio.BufferedInputStream | |
byte_order : Gio.DataStreamByteOrder
|
Gio.DataInputStream | |
close_base_stream : gboolean
|
Gio.FilterInputStream | |
newline_type : Gio.DataStreamNewlineType
|
Gio.DataInputStream | |
parent_instance : Gio.BufferedInputStream
read only
|
Gio.DataInputStream | |
priv : Gio.DataInputStreamPrivate
read only
|
Gio.DataInputStream |
Method / Constructor | Defined By | |
---|---|---|
new Gio.DataInputStream
(Object properties)
Create a new Gio.DataInputStream
Create a new Gio.DataInputStream
|
||
Create a new Gio.DataInputStream
Create a new Gio.DataInputStream
|
||
clear_pending
()
:
none
Clears the pending flag on stream.
Clears the pending flag on stream.
|
Gio.InputStream | |
close
(Cancellable cancellable)
:
gboolean
Closes the stream, releasing resources related to it.
Closes the stream, releasing resources related to it.
Once the stream is closed, all other operations will return G_IO_ERROR_CLOSED. Closing a stream multiple times will not return an error. Streams will be automatically closed when the last reference is dropped, but you might want to call this function to make sure resources are released as early as possible. Some streams might keep the backing store of the stream (e.g. a file descriptor) open after the stream is closed. See the documentation for the individual stream for details. On failure the first error that happened will be reported, but the close operation will finish as much as possible. A stream that failed to close will still return G_IO_ERROR_CLOSED for all operations. Still, it is important to check and report the error to the user. If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. Cancelling a close will still leave the stream closed, but some streams can use a faster close that doesn't block to e.g. check errors.
|
Gio.InputStream | |
close_async
(gint32 io_priority, Cancellable cancellable, Function callback, void* user_data)
:
none
Requests an asynchronous closes of the stream, releasing resources related to it.
Requests an asynchronous closes of the stream, releasing resources related to it.
When the operation is finished callback will be called. You can then call g_input_stream_close_finish() to get the result of the operation. For behaviour details see g_input_stream_close(). The asyncronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.
|
Gio.InputStream | |
close_finish
(AsyncResult result)
:
gboolean
Finishes closing a stream asynchronously, started from g_input_stream_close_async().
Finishes closing a stream asynchronously, started from g_input_stream_close_async().
|
Gio.InputStream | |
Tries to read count bytes from the stream into the buffer.
Tries to read count bytes from the stream into the buffer.
Will block during this read. If count is zero, returns zero and does nothing. A value of count larger than G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. On success, the number of bytes read into the buffer is returned. It is not an error if this is not the same as the requested size, as it can happen e.g. near the end of a file. Zero is returned on end of file (or if count is zero), but never otherwise. If count is -1 then the attempted read size is equal to the number of bytes that are required to fill the buffer. If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an operation was partially finished when the operation was cancelled the partial result will be returned, without an error. On error -1 is returned and error is set accordingly. For the asynchronous, non-blocking, version of this function, see g_buffered_input_stream_fill_async(). or -1 on error.
|
Gio.BufferedInputStream | |
fill_async
(gint32 count, gint32 io_priority, Cancellable cancellable, Function callback, void* user_data)
:
none
Reads data into stream's buffer asynchronously, up to count size.
Reads data into stream's buffer asynchronously, up to count size.
version of this function, see g_buffered_input_stream_fill(). If count is -1 then the attempted read size is equal to the number of bytes that are required to fill the buffer.
|
Gio.BufferedInputStream | |
fill_finish
(AsyncResult result)
:
gint32
Finishes an asynchronous read.
Finishes an asynchronous read.
|
Gio.BufferedInputStream | |
get_available
()
:
guint32
Gets the size of the available data within the stream.
Gets the size of the available data within the stream.
|
Gio.BufferedInputStream | |
get_base_stream
()
:
Gio.InputStream
Gets the base stream for the filter stream.
Gets the base stream for the filter stream.
|
Gio.FilterInputStream | |
get_buffer_size
()
:
guint32
Gets the size of the input buffer.
Gets the size of the input buffer.
|
Gio.BufferedInputStream | |
get_byte_order
()
:
Gio.DataStreamByteOrder
Gets the byte order for the data input stream.
Gets the byte order for the data input stream.
|
Gio.DataInputStream | |
get_close_base_stream
()
:
gboolean
Returns whether the base stream will be closed when stream is
closed.
Returns whether the base stream will be closed when stream is
closed.
|
Gio.FilterInputStream | |
get_newline_type
()
:
Gio.DataStreamNewlineType
Gets the current newline type for the stream.
Gets the current newline type for the stream.
|
Gio.DataInputStream | |
has_pending
()
:
gboolean
Checks if an input stream has pending actions.
Checks if an input stream has pending actions.
|
Gio.InputStream | |
is_closed
()
:
gboolean
Checks if an input stream is closed.
Checks if an input stream is closed.
|
Gio.InputStream | |
Peeks in the buffer, copying data of size count into buffer,
offset offset bytes.
Peeks in the buffer, copying data of size count into buffer,
offset offset bytes.
|
Gio.BufferedInputStream | |
Returns the buffer with the currently available bytes.
|
Gio.BufferedInputStream | |
Tries to read count bytes from the stream into the buffer starting at
If count is zero returns zero and does nothing.
Tries to read count bytes from the stream into the buffer starting at
If count is zero returns zero and does nothing. A value of count larger than G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. On success, the number of bytes read into the buffer is returned. It is not an error if this is not the same as the requested size, as it can happen e.g. near the end of a file. Zero is returned on end of file (or if count is zero), but never otherwise. If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an operation was partially finished when the operation was cancelled the partial result will be returned, without an error. On error -1 is returned and error is set accordingly.
|
Gio.InputStream | |
Tries to read count bytes from the stream into the buffer starting at
This function is similar to g_input_stream_read(), except it tries to read as many bytes as requested, only stopping on an error or end of stream.
Tries to read count bytes from the stream into the buffer starting at
This function is similar to g_input_stream_read(), except it tries to read as many bytes as requested, only stopping on an error or end of stream. On a successful read of count bytes, or if we reached the end of the stream, TRUE is returned, and bytes_read is set to the number of bytes read into buffer. If there is an error during the operation FALSE is returned and error is set to indicate the error status, bytes_read is updated to contain the number of bytes read into buffer before the error occurred.
|
Gio.InputStream | |
read_async
(void* buffer, guint32 count, gint32 io_priority, Cancellable cancellable, Function callback, void* user_data)
:
none
Request an asynchronous read of count bytes from the stream into the buffer
starting at buffer.
Request an asynchronous read of count bytes from the stream into the buffer
starting at buffer. When the operation is finished callback will be called. You can then call g_input_stream_read_finish() to get the result of the operation. During an async request no other sync and async calls are allowed on stream, and will result in G_IO_ERROR_PENDING errors. A value of count larger than G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. On success, the number of bytes read into the buffer will be passed to the callback. It is not an error if this is not the same as the requested size, as it can happen e.g. near the end of a file, but generally we try to read as many bytes as requested. Zero is returned on end of file (or if count is zero), but never otherwise. Any outstanding i/o request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is G_PRIORITY_DEFAULT. The asyncronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.
|
Gio.InputStream | |
read_byte
(Cancellable cancellable)
:
guint8
Reads an unsigned 8-bit/1-byte value from stream.
Reads an unsigned 8-bit/1-byte value from stream.
if an error occurred.
|
Gio.DataInputStream | |
read_finish
(AsyncResult result)
:
gint32
Finishes an asynchronous stream read operation.
Finishes an asynchronous stream read operation.
|
Gio.InputStream | |
read_int16
(Cancellable cancellable)
:
gint16
Reads a 16-bit/2-byte value from stream.
Reads a 16-bit/2-byte value from stream.
In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order(). an error occurred.
|
Gio.DataInputStream | |
read_int32
(Cancellable cancellable)
:
gint32
Reads a signed 32-bit/4-byte value from stream.
Reads a signed 32-bit/4-byte value from stream.
In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order(). If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. an error occurred.
|
Gio.DataInputStream | |
read_int64
(Cancellable cancellable)
:
gint64
Reads a 64-bit/8-byte value from stream.
Reads a 64-bit/8-byte value from stream.
In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order(). If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. an error occurred.
|
Gio.DataInputStream | |
Reads a line from the data input stream.
Reads a line from the data input stream.
If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. (without the newlines). Set length to a gsize to get the length of the read line. On an error, it will return NULL and still return NULL, but error won't be set.
|
Gio.DataInputStream | |
read_line_async
(gint32 io_priority, Cancellable cancellable, Function callback, void* user_data)
:
none
The asynchronous version of g_data_input_stream_read_line().
The asynchronous version of g_data_input_stream_read_line(). It is
an error to have two outstanding calls to this function. When the operation is finished, callback will be called. You can then call g_data_input_stream_read_line_finish() to get the result of the operation.
|
Gio.DataInputStream | |
Finish an asynchronous call started by
g_data_input_stream_read_line_async().
Finish an asynchronous call started by
g_data_input_stream_read_line_async(). (without the newlines). Set length to a gsize to get the length of the read line. On an error, it will return NULL and still return NULL, but error won't be set.
|
Gio.DataInputStream | |
read_uint16
(Cancellable cancellable)
:
guint16
Reads an unsigned 16-bit/2-byte value from stream.
Reads an unsigned 16-bit/2-byte value from stream.
In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order(). an error occurred.
|
Gio.DataInputStream | |
read_uint32
(Cancellable cancellable)
:
guint32
Reads an unsigned 32-bit/4-byte value from stream.
Reads an unsigned 32-bit/4-byte value from stream.
In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order(). If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. an error occurred.
|
Gio.DataInputStream | |
read_uint64
(Cancellable cancellable)
:
guint64
Reads an unsigned 64-bit/8-byte value from stream.
Reads an unsigned 64-bit/8-byte value from stream.
In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order(). If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. an error occurred.
|
Gio.DataInputStream | |
Reads a string from the data input stream, up to the first
occurrence of any of the stop characters.
Reads a string from the data input stream, up to the first
occurrence of any of the stop characters. Note that, in contrast to g_data_input_stream_read_until_async(), this function consumes the stop character that it finds. Don't use this function in new code. Its functionality is inconsistent with g_data_input_stream_read_until_async(). Both functions will be marked as deprecated in a future release. Use g_data_input_stream_read_upto() instead, but note that that function does not consume the stop character. before encountering any of the stop characters. Set length to a gsize to get the length of the string. This function will return NULL on an error.
|
Gio.DataInputStream | |
read_until_async
(String stop_chars, gint32 io_priority, Cancellable cancellable, Function callback, void* user_data)
:
none
The asynchronous version of g_data_input_stream_read_until().
The asynchronous version of g_data_input_stream_read_until().
It is an error to have two outstanding calls to this function. Note that, in contrast to g_data_input_stream_read_until(), this function does not consume the stop character that it finds. You must read it for yourself. When the operation is finished, callback will be called. You can then call g_data_input_stream_read_until_finish() to get the result of the operation. Don't use this function in new code. Its functionality is inconsistent with g_data_input_stream_read_until(). Both functions will be marked as deprecated in a future release. Use g_data_input_stream_read_upto_async() instead.
|
Gio.DataInputStream | |
Finish an asynchronous call started by
g_data_input_stream_read_until_async().
Finish an asynchronous call started by
g_data_input_stream_read_until_async(). before encountering any of the stop characters. Set length to a gsize to get the length of the string. This function will return NULL on an error.
|
Gio.DataInputStream | |
read_upto
(String stop_chars, gint32 stop_chars_len, Object out_values, Cancellable cancellable)
:
String
Reads a string from the data input stream, up to the first
occurrence of any of the stop characters.
Reads a string from the data input stream, up to the first
occurrence of any of the stop characters. In contrast to g_data_input_stream_read_until(), this function does to use g_data_input_stream_read_byte() to get it before calling g_data_input_stream_read_upto() again. Note that stop_chars may contain '\0' if stop_chars_len is specified. before encountering any of the stop characters. Set length to a gsize to get the length of the string. This function will return NULL on an error
|
Gio.DataInputStream | |
read_upto_async
(String stop_chars, gint32 stop_chars_len, gint32 io_priority, Cancellable cancellable, Function callback, void* user_data)
:
none
The asynchronous version of g_data_input_stream_read_upto().
The asynchronous version of g_data_input_stream_read_upto().
It is an error to have two outstanding calls to this function. In contrast to g_data_input_stream_read_until(), this function does to use g_data_input_stream_read_byte() to get it before calling g_data_input_stream_read_upto() again. Note that stop_chars may contain '\0' if stop_chars_len is specified. When the operation is finished, callback will be called. You can then call g_data_input_stream_read_upto_finish() to get the result of the operation.
|
Gio.DataInputStream | |
Finish an asynchronous call started by
g_data_input_stream_read_upto_async().
Finish an asynchronous call started by
g_data_input_stream_read_upto_async(). Note that this function does stop character. You have to use g_data_input_stream_read_byte() to get it before calling g_data_input_stream_read_upto_async() again. before encountering any of the stop characters. Set length to a gsize to get the length of the string. This function will return NULL on an error.
|
Gio.DataInputStream | |
set_buffer_size
(guint32 size)
:
none
Sets the size of the internal buffer of stream to size, or to the
size of the contents of the buffer.
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.
|
Gio.BufferedInputStream | |
set_byte_order
(DataStreamByteOrder order)
:
none
This function sets the byte order for the given stream.
This function sets the byte order for the given stream. All subsequent
reads from the stream will be read in the given order.
|
Gio.DataInputStream | |
set_close_base_stream
(gboolean close_base)
:
none
Sets whether the base stream will be closed when stream is closed.
Sets whether the base stream will be closed when stream is closed.
|
Gio.FilterInputStream | |
set_newline_type
(DataStreamNewlineType type)
:
none
Sets the newline type for the stream.
Sets the newline type for the stream.
Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read chunk ends in "CR" we must read an additional byte to know if this is "CR" or "CR LF", and this might block if there is no more data availible.
|
Gio.DataInputStream | |
set_pending
()
:
gboolean
Sets stream to have actions pending.
Sets stream to have actions pending. If the pending flag is
already set or stream is closed, it will return FALSE and set
|
Gio.InputStream | |
Tries to skip count bytes from the stream.
Tries to skip count bytes from the stream. Will block during the operation.
This is identical to g_input_stream_read(), from a behaviour standpoint, but the bytes that are skipped are not returned to the user. Some streams have an implementation that is more efficient than reading the data. This function is optional for inherited classes, as the default implementation emulates it using read. If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an operation was partially finished when the operation was cancelled the partial result will be returned, without an error.
|
Gio.InputStream | |
skip_async
(guint32 count, gint32 io_priority, Cancellable cancellable, Function callback, void* user_data)
:
none
Request an asynchronous skip of count bytes from the stream.
Request an asynchronous skip of count bytes from the stream.
When the operation is finished callback will be called. You can then call g_input_stream_skip_finish() to get the result of the operation. During an async request no other sync and async calls are allowed, and will result in G_IO_ERROR_PENDING errors. A value of count larger than G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. On success, the number of bytes skipped will be passed to the callback. It is not an error if this is not the same as the requested size, as it can happen e.g. near the end of a file, but generally we try to skip as many bytes as requested. Zero is returned on end of file (or if count is zero), but never otherwise. Any outstanding i/o request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is G_PRIORITY_DEFAULT. The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one, you must override all.
|
Gio.InputStream | |
skip_finish
(AsyncResult result)
:
gint32
Finishes a stream skip operation.
Finishes a stream skip operation.
|
Gio.InputStream |
None |