It derives from <GFilterInputStream>.
Buffered input stream implements
<GFilterInputStream> and provides for
buffered reads.
By default, <GBufferedInputStream>’s
buffer size is set at 4 kilobytes.
To create a buffered input stream, use buffered-input-stream:new, or buffered-input-stream:new-sized to specify the buffer’s
size at construction.
To get the size of a buffer within a buffered input stream, use
buffered-input-stream:get-buffer-size. To change the
size of a buffered input stream’s buffer, use
buffered-input-stream:set-buffer-size. Note that the
buffer’s size cannot be reduced below the size of the data within the
buffer.
parent-instanceThe size of the backend buffer, in bytes.
Its value is an unsigned 32-bit integer.
Set it with (set! (buffered-input-stream:buffer-size self)
value).
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
Gio.IOErrorEnum.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 Gio.IOErrorEnum.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
buffered-input-stream:fill-async.
Passed: a <GBufferedInputStream>.
Passed: a 64-bit integer.
the number of bytes that will be read from the stream
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, NULL to
ignore
Returned: a 64-bit integer.
the number of bytes read into self’s buffer, up to count, or
-1 on error.
Reads data into self’s buffer asynchronously, up to count
size. io-priority can be used to prioritize reads. For the
synchronous version of this function, see 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.
Passed: a <GBufferedInputStream>.
Passed: a 64-bit integer.
the number of bytes that will be read from the stream
Passed: a 32-bit integer.
the I/O priority of the request
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object
Passed, or left out: a procedure, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
a gpointer
Finishes an asynchronous read.
Passed: a <GBufferedInputStream>.
Passed: a <GAsyncResult>.
Returned: a 64-bit integer.
a gssize of the read stream, or -1 on an error.
Gets the size of the available data within the stream.
Passed: a <GBufferedInputStream>.
Returned: an unsigned 64-bit integer.
size of the available stream.
Gets the size of the input buffer.
Passed: a <GBufferedInputStream>.
Returned: an unsigned 64-bit integer.
the current buffer size.
Creates a new <GInputStream> from the given
base-stream, with a buffer set to the default size (4 kilobytes).
Passed: a <GInputStream>.
Returned: a <GInputStream>.
a <GInputStream> for the given
base-stream.
Creates a new <GBufferedInputStream>
from the given base-stream, with a buffer set to size.
Passed: a <GInputStream>.
Passed: an unsigned 64-bit integer.
a gsize
Returned: a <GInputStream>.
Peeks in the buffered input, copying count bytes of data from offset bytes in the buffered input into buffer.
Passed: a <GBufferedInputStream>.
Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.
a pointer to an allocated chunk of memory, which must be at least count bytes long
Passed: an unsigned 64-bit integer.
offset into the buffered input to peek from, or zero to peek from the next byte in the buffered input onwards
Returned: an unsigned 64-bit integer.
the number of bytes copied, which may be zero
Not passed: guile-gi gives the length of buffer.
number of bytes to peek
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.
Passed: a <GBufferedInputStream>.
Returned: a bytevector.
read-only buffer
Not returned: it is the length of %return.
a gsize to get the number of bytes available in the buffer
Tries to read a single byte from the stream or the buffer. Will block during this read.
On success, the byte read from the stream is returned. On end of stream
-1 is returned but it’s not an exceptional error and error
is not set.
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 Gio.IOErrorEnum.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.
Passed: a <GBufferedInputStream>.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, NULL to
ignore
Returned: a 32-bit integer.
the byte read from the self, or -1 on end of stream or
error.
Sets the size of the internal buffer of self to size, or to the size of the contents of the buffer. The buffer can never be resized smaller than its current contents.
Passed: a <GBufferedInputStream>.
Passed: an unsigned 64-bit integer.
a gsize
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
Gio.IOErrorEnum.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 Gio.IOErrorEnum.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
buffered-input-stream:fill-async.
To override it in a new class, give register-type #:vfuncs
`((fill . ,procedure)). The procedure is called as (procedure
self count cancellable) ⇒ %return.
Passed: the class whose implementation to call:
<GBufferedInputStream>, or a class
that derives from it, or its GType number.
Passed: a <GBufferedInputStream>.
Passed: a 64-bit integer.
the number of bytes that will be read from the stream
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, NULL to
ignore
Returned: a 64-bit integer.
the number of bytes read into self’s buffer, up to count, or
-1 on error.
Reads data into self’s buffer asynchronously, up to count
size. io-priority can be used to prioritize reads. For the
synchronous version of this function, see 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.
To override it in a new class, give register-type #:vfuncs
`((fill-async . ,procedure)). The procedure is called as
(procedure self count io-priority cancellable callback
user-data).
Passed: the class whose implementation to call:
<GBufferedInputStream>, or a class
that derives from it, or its GType number.
Passed: a <GBufferedInputStream>.
Passed: a 64-bit integer.
the number of bytes that will be read from the stream
Passed: a 32-bit integer.
the I/O priority of the request
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object
Passed, or left out: a procedure, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
a gpointer
Finishes an asynchronous read.
To override it in a new class, give register-type #:vfuncs
`((fill-finish . ,procedure)). The procedure is called as
(procedure self result) ⇒ %return.
Passed: the class whose implementation to call:
<GBufferedInputStream>, or a class
that derives from it, or its GType number.
Passed: a <GBufferedInputStream>.
Passed: a <GAsyncResult>.
Returned: a 64-bit integer.
a gssize of the read stream, or -1 on an error.