Class: Gio::DataInputStream
- Inherits:
-
BufferedInputStream
- Object
- InputStream
- FilterInputStream
- BufferedInputStream
- Gio::DataInputStream
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#byte_order ⇒ Gio::DataStreamByteOrder
The :byte-order property determines the byte ordering that is used when reading multi-byte entities (such as integers) from the stream.
-
#byte_order=(byte_order) ⇒ Gio::DataStreamByteOrder
The :byte-order property determines the byte ordering that is used when reading multi-byte entities (such as integers) from the stream.
-
#initialize(base_stream) ⇒ Gio::DataInputStream
constructor
Creates a new data input stream for the base_stream.
-
#newline_type ⇒ Gio::DataStreamNewlineType
The :newline-type property determines what is considered as a line ending when reading complete lines from the stream.
-
#newline_type=(newline_type) ⇒ Gio::DataStreamNewlineType
The :newline-type property determines what is considered as a line ending when reading complete lines from the stream.
-
#read_byte(cancellable) ⇒ Integer
Reads an unsigned 8-bit/1-byte value from stream.
-
#read_int16(cancellable) ⇒ Integer
Reads a 16-bit/2-byte value from stream.
-
#read_int32(cancellable) ⇒ Integer
Reads a signed 32-bit/4-byte value from stream.
-
#read_int64(cancellable) ⇒ Integer
Reads a 64-bit/8-byte value from stream.
-
#read_line(length, cancellable) ⇒ Array<Integer>
Reads a line from the data input stream.
-
#read_line_async(io_priority, cancellable, callback, user_data) ⇒ nil
The asynchronous version of g_data_input_stream_read_line().
-
#read_line_finish(result, length) ⇒ Array<Integer>
Finish an asynchronous call started by g_data_input_stream_read_line_async().
-
#read_line_finish_utf8(result, length) ⇒ String
Finish an asynchronous call started by g_data_input_stream_read_line_async().
-
#read_line_utf8(length, cancellable) ⇒ String
Reads a UTF-8 encoded line from the data input stream.
-
#read_uint16(cancellable) ⇒ Integer
Reads an unsigned 16-bit/2-byte value from stream.
-
#read_uint32(cancellable) ⇒ Integer
Reads an unsigned 32-bit/4-byte value from stream.
-
#read_uint64(cancellable) ⇒ Integer
Reads an unsigned 64-bit/8-byte value from stream.
-
#read_until(stop_chars, length, cancellable) ⇒ String
Reads a string from the data input stream, up to the first occurrence of any of the stop characters.
-
#read_until_async(stop_chars, io_priority, cancellable, callback, user_data) ⇒ nil
The asynchronous version of g_data_input_stream_read_until().
-
#read_until_finish(result, length) ⇒ String
Finish an asynchronous call started by g_data_input_stream_read_until_async().
-
#read_upto(stop_chars, stop_chars_len, length, cancellable) ⇒ String
Reads a string from the data input stream, up to the first occurrence of any of the stop characters.
-
#read_upto_async(stop_chars, stop_chars_len, io_priority, cancellable, callback, user_data) ⇒ nil
The asynchronous version of g_data_input_stream_read_upto().
-
#read_upto_finish(result, length) ⇒ String
Finish an asynchronous call started by g_data_input_stream_read_upto_async().
Methods inherited from BufferedInputStream
#available, #buffer_size, #buffer_size=, #fill, #fill_async, #fill_finish, #peek, #peek_buffer
Methods inherited from FilterInputStream
#base_stream, #base_stream=, #close_base_stream, #close_base_stream=, #close_base_stream?
Methods inherited from InputStream
#clear_pending, #close, #close_async, #close_finish, #has_pending, #is_closed, open, #read, #read_all, #read_all_async, #read_all_finish, #read_all_raw, #read_async, #read_bytes, #read_bytes_async, #read_bytes_finish, #read_finish, #read_raw, #set_pending, #skip, #skip_async, #skip_finish
Constructor Details
#initialize(base_stream) ⇒ Gio::DataInputStream
Creates a new data input stream for the base_stream.
Instance Method Details
#byte_order ⇒ Gio::DataStreamByteOrder
The :byte-order property determines the byte ordering that
is used when reading multi-byte entities (such as integers)
from the stream.
#byte_order=(byte_order) ⇒ Gio::DataStreamByteOrder
The :byte-order property determines the byte ordering that
is used when reading multi-byte entities (such as integers)
from the stream.
#newline_type ⇒ Gio::DataStreamNewlineType
The :newline-type property determines what is considered
as a line ending when reading complete lines from the stream.
#newline_type=(newline_type) ⇒ Gio::DataStreamNewlineType
The :newline-type property determines what is considered
as a line ending when reading complete lines from the stream.
#read_byte(cancellable) ⇒ Integer
Reads an unsigned 8-bit/1-byte value from stream.
if an error occurred.
#read_int16(cancellable) ⇒ Integer
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.
#read_int32(cancellable) ⇒ Integer
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 nil, 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.
#read_int64(cancellable) ⇒ Integer
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 nil, 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.
#read_line(length, cancellable) ⇒ Array<Integer>
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.
If cancellable is not nil, 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.
#read_line_async(io_priority, cancellable, callback, user_data) ⇒ nil
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.
#read_line_finish(result, length) ⇒ Array<Integer>
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.
#read_line_finish_utf8(result, length) ⇒ String
Finish an asynchronous call started by
g_data_input_stream_read_line_async().
#read_line_utf8(length, cancellable) ⇒ String
Reads a UTF-8 encoded line from the data input stream.
If cancellable is not nil, 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.
#read_uint16(cancellable) ⇒ Integer
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.
#read_uint32(cancellable) ⇒ Integer
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 nil, 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.
#read_uint64(cancellable) ⇒ Integer
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 nil, 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.
#read_until(stop_chars, length, cancellable) ⇒ String
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.
#read_until_async(stop_chars, io_priority, cancellable, callback, user_data) ⇒ nil
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.
#read_until_finish(result, length) ⇒ String
Finish an asynchronous call started by
g_data_input_stream_read_until_async().
#read_upto(stop_chars, stop_chars_len, length, cancellable) ⇒ String
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 not consume the stop character. You have 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.
The returned string will always be nul-terminated on success.
#read_upto_async(stop_chars, stop_chars_len, io_priority, cancellable, callback, user_data) ⇒ nil
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 not consume the stop character. You have 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.
#read_upto_finish(result, length) ⇒ String
Finish an asynchronous call started by
g_data_input_stream_read_upto_async().
Note that this function does not consume the 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.
The returned string will always be nul-terminated on success.