Blame docs/reference/gio/html/GBufferedInputStream.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>GBufferedInputStream: GIO Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GIO Reference Manual">
Packit ae235b
<link rel="up" href="streaming.html" title="Streaming I/O">
Packit ae235b
<link rel="prev" href="GMemoryOutputStream.html" title="GMemoryOutputStream">
Packit ae235b
<link rel="next" href="GBufferedOutputStream.html" title="GBufferedOutputStream">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description  | 
Packit ae235b
                  Object Hierarchy  | 
Packit ae235b
                  Implemented Interfaces  | 
Packit ae235b
                  Properties
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

GBufferedInputStream

Packit ae235b

GBufferedInputStream — Buffered Input Stream

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GInputStream *
Packit ae235b
Packit ae235b
Packit ae235b
g_buffered_input_stream_new ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GInputStream *
Packit ae235b
Packit ae235b
Packit ae235b
g_buffered_input_stream_new_sized ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gsize
Packit ae235b
Packit ae235b
Packit ae235b
g_buffered_input_stream_get_buffer_size ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_buffered_input_stream_set_buffer_size ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gsize
Packit ae235b
Packit ae235b
Packit ae235b
g_buffered_input_stream_get_available ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
const void *
Packit ae235b
Packit ae235b
Packit ae235b
g_buffered_input_stream_peek_buffer ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gsize
Packit ae235b
Packit ae235b
Packit ae235b
g_buffered_input_stream_peek ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gssize
Packit ae235b
Packit ae235b
Packit ae235b
g_buffered_input_stream_fill ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_buffered_input_stream_fill_async ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gssize
Packit ae235b
Packit ae235b
Packit ae235b
g_buffered_input_stream_fill_finish ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
int
Packit ae235b
Packit ae235b
Packit ae235b
g_buffered_input_stream_read_byte ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Properties

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
guint
Packit ae235b
buffer-size
Packit ae235b
Read / Write / Construct
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
 
Packit ae235b
GBufferedInputStream
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Object Hierarchy

Packit ae235b
    GObject
Packit ae235b
    ╰── GInputStream
Packit ae235b
        ╰── GFilterInputStream
Packit ae235b
            ╰── GBufferedInputStream
Packit ae235b
                ╰── GDataInputStream
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Implemented Interfaces

Packit ae235b

Packit ae235b
GBufferedInputStream implements
Packit ae235b
 GSeekable.

Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <gio/gio.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

Buffered input stream implements GFilterInputStream and provides

Packit ae235b
for buffered reads.

Packit ae235b

By default, GBufferedInputStream's buffer size is set at 4 kilobytes.

Packit ae235b

To create a buffered input stream, use g_buffered_input_stream_new(),

Packit ae235b
or g_buffered_input_stream_new_sized() to specify the buffer's size at
Packit ae235b
construction.

Packit ae235b

To get the size of a buffer within a buffered input stream, use

Packit ae235b
g_buffered_input_stream_get_buffer_size(). To change the size of a
Packit ae235b
buffered input stream's buffer, use
Packit ae235b
g_buffered_input_stream_set_buffer_size(). Note that the buffer's size
Packit ae235b
cannot be reduced below the size of the data within the buffer.

Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b

g_buffered_input_stream_new ()

Packit ae235b
GInputStream *
Packit ae235b
g_buffered_input_stream_new (GInputStream *base_stream);
Packit ae235b

Creates a new GInputStream from the given base_stream

Packit ae235b
, with
Packit ae235b
a buffer set to the default size (4 kilobytes).

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

base_stream

Packit ae235b

a GInputStream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a GInputStream for the given base_stream

Packit ae235b
.

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_buffered_input_stream_new_sized ()

Packit ae235b
GInputStream *
Packit ae235b
g_buffered_input_stream_new_sized (GInputStream *base_stream,
Packit ae235b
                                   gsize size);
Packit ae235b

Creates a new GBufferedInputStream from the given base_stream

Packit ae235b
,
Packit ae235b
with a buffer set to size
Packit ae235b
.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

base_stream

Packit ae235b

a GInputStream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

size

Packit ae235b

a gsize

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a GInputStream.

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_buffered_input_stream_get_buffer_size ()

Packit ae235b
gsize
Packit ae235b
g_buffered_input_stream_get_buffer_size
Packit ae235b
                               (GBufferedInputStream *stream);
Packit ae235b

Gets the size of the input buffer.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

stream

Packit ae235b

a GBufferedInputStream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the current buffer size.

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_buffered_input_stream_set_buffer_size ()

Packit ae235b
void
Packit ae235b
g_buffered_input_stream_set_buffer_size
Packit ae235b
                               (GBufferedInputStream *stream,
Packit ae235b
                                gsize size);
Packit ae235b

Sets the size of the internal buffer of stream

Packit ae235b
 to size
Packit ae235b
, or to the
Packit ae235b
size of the contents of the buffer. The buffer can never be resized
Packit ae235b
smaller than its current contents.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

stream

Packit ae235b

a GBufferedInputStream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

size

Packit ae235b

a gsize

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_buffered_input_stream_get_available ()

Packit ae235b
gsize
Packit ae235b
g_buffered_input_stream_get_available (GBufferedInputStream *stream);
Packit ae235b

Gets the size of the available data within the stream.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

stream

Packit ae235b

GBufferedInputStream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

size of the available stream.

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_buffered_input_stream_peek_buffer ()

Packit ae235b
const void *
Packit ae235b
g_buffered_input_stream_peek_buffer (GBufferedInputStream *stream,
Packit ae235b
                                     gsize *count);
Packit ae235b

Returns the buffer with the currently available bytes. The returned

Packit ae235b
buffer must not be modified and will become invalid when reading from
Packit ae235b
the stream or filling the buffer.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

stream

Packit ae235b

a GBufferedInputStream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

count

Packit ae235b

a gsize to get the number of bytes available in the buffer.

Packit ae235b
[out]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

read-only buffer.

Packit ae235b

[array length=count][element-type guint8][transfer none]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_buffered_input_stream_peek ()

Packit ae235b
gsize
Packit ae235b
g_buffered_input_stream_peek (GBufferedInputStream *stream,
Packit ae235b
                              void *buffer,
Packit ae235b
                              gsize offset,
Packit ae235b
                              gsize count);
Packit ae235b

Peeks in the buffer, copying data of size count

Packit ae235b
 into buffer
Packit ae235b
,
Packit ae235b
offset offset
Packit ae235b
 bytes.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

stream

Packit ae235b

a GBufferedInputStream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

buffer

Packit ae235b

a pointer to

Packit ae235b
an allocated chunk of memory. 

Packit ae235b
[array length=count][element-type guint8]
Packit ae235b
Packit ae235b
Packit ae235b

offset

Packit ae235b

a gsize

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

count

Packit ae235b

a gsize

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a gsize of the number of bytes peeked, or -1 on error.

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_buffered_input_stream_fill ()

Packit ae235b
gssize
Packit ae235b
g_buffered_input_stream_fill (GBufferedInputStream *stream,
Packit ae235b
                              gssize count,
Packit ae235b
                              GCancellable *cancellable,
Packit ae235b
                              GError **error);
Packit ae235b

Tries to read count

Packit ae235b
 bytes from the stream into the buffer.
Packit ae235b
Will block during this read.

Packit ae235b

If count

Packit ae235b
 is zero, returns zero and does nothing. A value of count
Packit ae235b
Packit ae235b
larger than G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error.

Packit ae235b

On success, the number of bytes read into the buffer is returned.

Packit ae235b
It is not an error if this is not the same as the requested size, as it
Packit ae235b
can happen e.g. near the end of a file. Zero is returned on end of file
Packit ae235b
(or if count
Packit ae235b
 is zero),  but never otherwise.

Packit ae235b

If count

Packit ae235b
 is -1 then the attempted read size is equal to the number of
Packit ae235b
bytes that are required to fill the buffer.

Packit ae235b

If cancellable

Packit ae235b
 is not NULL, then the operation can be cancelled by
Packit ae235b
triggering the cancellable object from another thread. If the operation
Packit ae235b
was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an
Packit ae235b
operation was partially finished when the operation was cancelled the
Packit ae235b
partial result will be returned, without an error.

Packit ae235b

On error -1 is returned and error

Packit ae235b
 is set accordingly.

Packit ae235b

For the asynchronous, non-blocking, version of this function, see

Packit ae235b
g_buffered_input_stream_fill_async().

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

stream

Packit ae235b

a GBufferedInputStream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

count

Packit ae235b

the number of bytes that will be read from the stream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

cancellable

Packit ae235b

optional GCancellable object, NULL to ignore.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

location to store the error occurring, or NULL to ignore

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the number of bytes read into stream

Packit ae235b
's buffer, up to count
Packit ae235b
,
Packit ae235b
or -1 on error.

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_buffered_input_stream_fill_async ()

Packit ae235b
void
Packit ae235b
g_buffered_input_stream_fill_async (GBufferedInputStream *stream,
Packit ae235b
                                    gssize count,
Packit ae235b
                                    int io_priority,
Packit ae235b
                                    GCancellable *cancellable,
Packit ae235b
                                    GAsyncReadyCallback callback,
Packit ae235b
                                    gpointer user_data);
Packit ae235b

Reads data into stream

Packit ae235b
's buffer asynchronously, up to count
Packit ae235b
 size.
Packit ae235b
io_priority
Packit ae235b
 can be used to prioritize reads. For the synchronous
Packit ae235b
version of this function, see g_buffered_input_stream_fill().

Packit ae235b

If count

Packit ae235b
 is -1 then the attempted read size is equal to the number
Packit ae235b
of bytes that are required to fill the buffer.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

stream

Packit ae235b

a GBufferedInputStream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

count

Packit ae235b

the number of bytes that will be read from the stream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

io_priority

Packit ae235b

the I/O priority of the request

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

cancellable

Packit ae235b

optional GCancellable object.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

callback

Packit ae235b

a GAsyncReadyCallback.

Packit ae235b
[scope async]
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

a gpointer.

Packit ae235b
[closure]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_buffered_input_stream_fill_finish ()

Packit ae235b
gssize
Packit ae235b
g_buffered_input_stream_fill_finish (GBufferedInputStream *stream,
Packit ae235b
                                     GAsyncResult *result,
Packit ae235b
                                     GError **error);
Packit ae235b

Finishes an asynchronous read.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

stream

Packit ae235b

a GBufferedInputStream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

result

Packit ae235b

a GAsyncResult

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

a GError

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a gssize of the read stream, or -1 on an error.

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_buffered_input_stream_read_byte ()

Packit ae235b
int
Packit ae235b
g_buffered_input_stream_read_byte (GBufferedInputStream *stream,
Packit ae235b
                                   GCancellable *cancellable,
Packit ae235b
                                   GError **error);
Packit ae235b

Tries to read a single byte from the stream or the buffer. Will block

Packit ae235b
during this read.

Packit ae235b

On success, the byte read from the stream is returned. On end of stream

Packit ae235b
-1 is returned but it's not an exceptional error and error
Packit ae235b
 is not set.

Packit ae235b

If cancellable

Packit ae235b
 is not NULL, then the operation can be cancelled by
Packit ae235b
triggering the cancellable object from another thread. If the operation
Packit ae235b
was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an
Packit ae235b
operation was partially finished when the operation was cancelled the
Packit ae235b
partial result will be returned, without an error.

Packit ae235b

On error -1 is returned and error

Packit ae235b
 is set accordingly.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

stream

Packit ae235b

a GBufferedInputStream

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

cancellable

Packit ae235b

optional GCancellable object, NULL to ignore.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

location to store the error occurring, or NULL to ignore

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the byte read from the stream

Packit ae235b
, or -1 on end of stream or error.

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b

GBufferedInputStream

Packit ae235b
typedef struct _GBufferedInputStream GBufferedInputStream;
Packit ae235b

Implements GFilterInputStream with a sized input buffer.

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Property Details

Packit ae235b
Packit ae235b

The “buffer-size” property

Packit ae235b
  “buffer-size”              guint
Packit ae235b

The size of the backend buffer.

Packit ae235b

Flags: Read / Write / Construct

Packit ae235b

Allowed values: >= 1

Packit ae235b

Default value: 4096

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

See Also

Packit ae235b

GFilterInputStream, GInputStream

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Generated by GTK-Doc V1.27
Packit ae235b
</body>
Packit ae235b
</html>