It derives from
<GBufferedInputStream>.
Data input stream implements <GInputStream>
and includes functions for reading structured data directly from a
binary input stream.
parent-instanceThe :byte-order property determines the byte ordering that is used when reading multi-byte entities (such as integers) from the stream.
Its value is a <GDataStreamByteOrder>
(or, to set it, one of its symbols).
Set it with (set! (data-input-stream:byte-order self) value).
The :newline-type property determines what is considered as a line ending when reading complete lines from the stream.
Its value is a
<GDataStreamNewlineType> (or, to set
it, one of its symbols).
Set it with (set! (data-input-stream:newline-type self) value).
Gets the byte order for the data input stream.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Returned: a <GDataStreamByteOrder>.
the self’s current
<GDataStreamByteOrder>.
Gets the current newline type for the self.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Returned: a
<GDataStreamNewlineType>.
<GDataStreamNewlineType> for the
given self.
Creates a new data input stream for the base-stream.
Passed: a <GInputStream>.
Returned: a <GDataInputStream>.
a new <GDataInputStream>.
Reads an unsigned 8-bit/1-byte value from self.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Returned: an unsigned 8-bit integer.
an unsigned 8-bit/1-byte value read from the self or 0 if
an error occurred.
Reads a 16-bit/2-byte value from self.
In order to get the correct byte order for this read operation, see
data-input-stream:get-byte-order and
data-input-stream:set-byte-order.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Returned: a 16-bit integer.
a signed 16-bit/2-byte value read from self or 0 if an
error occurred.
Reads a signed 32-bit/4-byte value from self.
In order to get the correct byte order for this read operation, see
data-input-stream:get-byte-order and
data-input-stream:set-byte-order.
If cancellable is not #f, then the operation can be
cancelled by triggering the cancellable object from another thread. If
the operation was cancelled, the error
cancelled will be returned.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Returned: a 32-bit integer.
a signed 32-bit/4-byte value read from the self or 0 if an
error occurred.
Reads a 64-bit/8-byte value from self.
In order to get the correct byte order for this read operation, see
data-input-stream:get-byte-order and
data-input-stream:set-byte-order.
If cancellable is not #f, then the operation can be
cancelled by triggering the cancellable object from another thread. If
the operation was cancelled, the error
cancelled will be returned.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Returned: a 64-bit integer.
a signed 64-bit/8-byte value read from self or 0 if an
error occurred.
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 #f, then the operation can be
cancelled by triggering the cancellable object from another thread. If
the operation was cancelled, the error
cancelled will be returned.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Returned: a bytevector, or #f.
a NUL terminated byte array with the line that was read in (without the
newlines). Set length to a gsize to get the length of the
read line. On an error, it will return #f and error will
be set. If there’s no content to read, it will still return #f,
but error won’t be set.
Returned: an unsigned 64-bit integer.
a gsize to get the length of the data read in.
The asynchronous version of 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 data-input-stream:read-line-finish to get the result
of the operation.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed: a 32-bit integer.
the I/O priority of the request
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Passed, or left out: a procedure, or #f.
callback to call when the request is satisfied.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
the data to pass to callback function.
Finish an asynchronous call started by data-input-stream:read-line-async. Note the warning
about string encoding in data-input-stream:read-line applies here as well.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed: a <GAsyncResult>.
the <GAsyncResult> that was provided to the
callback.
Returned: a bytevector, or #f.
a NUL-terminated byte array with the line that was read in (without the
newlines). Set length to a gsize to get the length of the
read line. On an error, it will return #f and error will
be set. If there’s no content to read, it will still return #f,
but error won’t be set.
Returned: an unsigned 64-bit integer.
a gsize to get the length of the data read in.
Finish an asynchronous call started by data-input-stream:read-line-async.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed: a <GAsyncResult>.
the <GAsyncResult> that was provided to the
callback.
Returned: a string, or #f.
a string with the line that was read in (without the newlines). Set
length to a gsize to get the length of the read line. On
an error, it will return #f and error will be set. For
UTF-8 conversion errors, the set error domain is G_CONVERT_ERROR.
If there’s no content to read, it will still return #f, but
error won’t be set.
Returned: an unsigned 64-bit integer.
a gsize to get the length of the data read in.
Reads a UTF-8 encoded line from the data input stream.
If cancellable is not #f, then the operation can be
cancelled by triggering the cancellable object from another thread. If
the operation was cancelled, the error
cancelled will be returned.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Returned: a string, or #f.
a NUL terminated UTF-8 string with the line that was read in (without
the newlines). Set length to a gsize to get the length of
the read line. On an error, it will return #f and error
will be set. For UTF-8 conversion errors, the set error domain is
G_CONVERT_ERROR. If there’s no content to read, it will still
return #f, but error won’t be set.
Returned: an unsigned 64-bit integer.
a gsize to get the length of the data read in.
Reads an unsigned 16-bit/2-byte value from self.
In order to get the correct byte order for this read operation, see
data-input-stream:get-byte-order and
data-input-stream:set-byte-order.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Returned: an unsigned 16-bit integer.
an unsigned 16-bit/2-byte value read from the self or 0 if
an error occurred.
Reads an unsigned 32-bit/4-byte value from self.
In order to get the correct byte order for this read operation, see
data-input-stream:get-byte-order and
data-input-stream:set-byte-order.
If cancellable is not #f, then the operation can be
cancelled by triggering the cancellable object from another thread. If
the operation was cancelled, the error
cancelled will be returned.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Returned: an unsigned 32-bit integer.
an unsigned 32-bit/4-byte value read from the self or 0 if
an error occurred.
Reads an unsigned 64-bit/8-byte value from self.
In order to get the correct byte order for this read operation, see
data-input-stream:get-byte-order.
If cancellable is not #f, then the operation can be
cancelled by triggering the cancellable object from another thread. If
the operation was cancelled, the error
cancelled will be returned.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Returned: an unsigned 64-bit integer.
an unsigned 64-bit/8-byte read from self or 0 if an error
occurred.
Reads a string from the data input stream, up to the first occurrence of any of the stop characters.
Note that, in contrast to 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 data-input-stream:read-until-async. Both functions
will be marked as deprecated in a future release. Use
data-input-stream:read-upto
instead, but note that that function does not consume the stop
character.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed: a string.
characters to terminate the read.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Returned: a string.
a string with the data that was read before encountering any of the stop
characters. Set length to a gsize to get the length of the
string. This function will return #f on an error.
Returned: an unsigned 64-bit integer.
a gsize to get the length of the data read in.
The asynchronous version of data-input-stream:read-until. It is an error to have two
outstanding calls to this function.
Note that, in contrast to 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 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 data-input-stream:read-until. Both functions will be
marked as deprecated in a future release. Use
data-input-stream:read-upto-async instead.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed: a string.
characters to terminate the read.
Passed: a 32-bit integer.
the I/O priority of the request
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Passed, or left out: a procedure, or #f.
callback to call when the request is satisfied.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
the data to pass to callback function.
Finish an asynchronous call started by data-input-stream:read-until-async.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed: a <GAsyncResult>.
the <GAsyncResult> that was provided to the
callback.
Returned: a string.
a string with the data that was read before encountering any of the stop
characters. Set length to a gsize to get the length of the
string. This function will return #f on an error.
Returned: an unsigned 64-bit integer.
a gsize to get the length of the data read in.
Reads a string from the data input stream, up to the first occurrence of any of the stop characters.
In contrast to data-input-stream:read-until, this function does not
consume the stop character. You have to use data-input-stream:read-byte to get it before calling
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.
Passed: a <GDataInputStream>.
Passed: a string.
characters to terminate the read
Passed: a 64-bit integer.
length of stop-chars. May be -1 if stop-chars is nul-terminated
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore
Returned: a string.
a string with the data that was read before encountering any of the stop
characters. Set length to a gsize to get the length of the
string. This function will return #f on an error
Returned: an unsigned 64-bit integer.
a gsize to get the length of the data read in
The asynchronous version of data-input-stream:read-upto. It is an error to have two
outstanding calls to this function.
In contrast to data-input-stream:read-until, this function does not
consume the stop character. You have to use data-input-stream:read-byte to get it before calling
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 data-input-stream:read-upto-finish to get the result
of the operation.
Passed: a <GDataInputStream>.
Passed: a string.
characters to terminate the read
Passed: a 64-bit integer.
length of stop-chars. May be -1 if stop-chars is nul-terminated
Passed: a 32-bit integer.
the I/O priority of the request
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore
Passed, or left out: a procedure, or #f.
callback to call when the request is satisfied
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
the data to pass to callback function
Finish an asynchronous call started by data-input-stream:read-upto-async.
Note that this function does not consume the stop character. You have
to use data-input-stream:read-byte to get it before calling
data-input-stream:read-upto-async again.
The returned string will always be nul-terminated on success.
Passed: a <GDataInputStream>.
Passed: a <GAsyncResult>.
the <GAsyncResult> that was provided to the
callback
Returned: a string.
a string with the data that was read before encountering any of the stop
characters. Set length to a gsize to get the length of the
string. This function will return #f on an error.
Returned: an unsigned 64-bit integer.
a gsize to get the length of the data read in
This function sets the byte order for the given self. All subsequent reads from the self will be read in the given order.
Passed: a <GDataInputStream>.
a given <GDataInputStream>.
Passed: a <GDataStreamByteOrder>, or
one of its symbols.
a <GDataStreamByteOrder> to set.
Sets the newline type for the self.
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 available.
Passed: a <GDataInputStream>.
Passed: a <GDataStreamNewlineType>,
or one of its symbols.
the type of new line return as
<GDataStreamNewlineType>.