Class: Gio::BufferedInputStream
- Inherits:
-
Object
- Object
- Gio::BufferedInputStream
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#available ⇒ Integer
Gets the size of the available data within the stream.
-
#buffer_size ⇒ Integer
Buffer-size.
- #buffer_size=(buffer_size) ⇒ Integer
-
#fill(count, cancellable) ⇒ Gio::gssize
Tries to read count bytes from the stream into the buffer.
-
#fill_async(count, io_priority, cancellable, callback, user_data) ⇒ nil
Reads data into stream’s buffer asynchronously, up to count size.
-
#fill_finish(result) ⇒ Gio::gssize
Finishes an asynchronous read.
-
#new(base_stream) ⇒ Gio::InputStream
Creates a new GInput::Stream from the given base_stream, with a buffer set to the default size (4 kilobytes).
-
#new_sized(base_stream, size) ⇒ Gio::InputStream
Creates a new GBuffered::InputStream from the given base_stream, with a buffer set to size.
-
#peek(buffer, offset, count) ⇒ Integer
Peeks in the buffer, copying data of size count into buffer, offset offset bytes.
-
#peek_buffer(count) ⇒ Array<Integer>
Returns the buffer with the currently available bytes.
-
#read_byte(cancellable) ⇒ Integer
Tries to read a single byte from the stream or the buffer.
Instance Method Details
#available ⇒ Integer
Gets the size of the available data within the stream.
#buffer_size ⇒ Integer
Returns buffer-size.
#buffer_size=(buffer_size) ⇒ Integer
#fill(count, cancellable) ⇒ Gio::gssize
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 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. 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().
#fill_async(count, io_priority, cancellable, callback, user_data) ⇒ nil
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().
If count is -1 then the attempted read size is equal to the number of bytes that are required to fill the buffer.
#fill_finish(result) ⇒ Gio::gssize
Finishes an asynchronous read.
#new(base_stream) ⇒ Gio::InputStream
Creates a new GInput::Stream from the given base_stream, with a buffer set to the default size (4 kilobytes).
#new_sized(base_stream, size) ⇒ Gio::InputStream
Creates a new GBuffered::InputStream from the given base_stream, with a buffer set to size.
#peek(buffer, offset, count) ⇒ Integer
Peeks in the buffer, copying data of size count into buffer, offset offset bytes.
#peek_buffer(count) ⇒ Array<Integer>
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.
#read_byte(cancellable) ⇒ Integer
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 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. 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.