EvdBufferedInputStream

EvdBufferedInputStream

Synopsis

struct              EvdBufferedInputStream;
struct              EvdBufferedInputStreamClass;
EvdBufferedInputStream * evd_buffered_input_stream_new  (GInputStream *base_stream);
gssize              evd_buffered_input_stream_unread    (EvdBufferedInputStream *self,
                                                         const void *buffer,
                                                         gsize size,
                                                         GCancellable *cancellable,
                                                         GError **error);
gchar *             evd_buffered_input_stream_read_str  (EvdBufferedInputStream *self,
                                                         gssize *size,
                                                         GError **error);
void                evd_buffered_input_stream_read_str_async
                                                        (EvdBufferedInputStream *stream,
                                                         gsize count,
                                                         int io_priority,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gchar *             evd_buffered_input_stream_read_str_finish
                                                        (EvdBufferedInputStream *self,
                                                         GAsyncResult *result,
                                                         gssize *size,
                                                         GError **error);
void                evd_buffered_input_stream_freeze    (EvdBufferedInputStream *self);
void                evd_buffered_input_stream_thaw      (EvdBufferedInputStream *self,
                                                         gint priority);

Object Hierarchy

  GObject
   +----GInputStream
         +----GFilterInputStream
               +----GBufferedInputStream
                     +----EvdBufferedInputStream

Implemented Interfaces

EvdBufferedInputStream implements GSeekable.

Description

Details

struct EvdBufferedInputStream

struct EvdBufferedInputStream;


struct EvdBufferedInputStreamClass

struct EvdBufferedInputStreamClass {
  GBufferedInputStreamClass parent_class;

  /* padding for future expansion */
  void (* _padding_0_) (void);
  void (* _padding_1_) (void);
  void (* _padding_2_) (void);
  void (* _padding_3_) (void);
  void (* _padding_4_) (void);
  void (* _padding_5_) (void);
  void (* _padding_6_) (void);
  void (* _padding_7_) (void);
};


evd_buffered_input_stream_new ()

EvdBufferedInputStream * evd_buffered_input_stream_new  (GInputStream *base_stream);


evd_buffered_input_stream_unread ()

gssize              evd_buffered_input_stream_unread    (EvdBufferedInputStream *self,
                                                         const void *buffer,
                                                         gsize size,
                                                         GCancellable *cancellable,
                                                         GError **error);

Stores size bytes from buffer in the local read buffer of the socket. Next calls to read will first get data from the local buffer, before performing the actual read operation. This is useful when one needs to do some action with a data just read, but doesn't want to remove the data from the input stream of the socket.

Normally, it would be used to write back data that was previously read, to made it available in further calls to read. But in practice any data can be unread.

This feature was implemented basically to provide type-of-stream detection on a socket (e.g. a service selector).

self :

The EvdConnection to unread data to.

buffer :

Buffer holding the data to be unread. Can contain nulls. [transfer none]

size :

Number of bytes to unread.

cancellable :

A GCancellable object, or NULL.

error :

A pointer to a GError to return, or NULL. [out][transfer full]

Returns :

The actual number of bytes unread.

evd_buffered_input_stream_read_str ()

gchar *             evd_buffered_input_stream_read_str  (EvdBufferedInputStream *self,
                                                         gssize *size,
                                                         GError **error);

size :

. [inout]

evd_buffered_input_stream_read_str_async ()

void                evd_buffered_input_stream_read_str_async
                                                        (EvdBufferedInputStream *stream,
                                                         gsize count,
                                                         int io_priority,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

callback :

the GAsyncReadyCallback. [scope async]

evd_buffered_input_stream_read_str_finish ()

gchar *             evd_buffered_input_stream_read_str_finish
                                                        (EvdBufferedInputStream *self,
                                                         GAsyncResult *result,
                                                         gssize *size,
                                                         GError **error);

size :

. [out]

evd_buffered_input_stream_freeze ()

void                evd_buffered_input_stream_freeze    (EvdBufferedInputStream *self);


evd_buffered_input_stream_thaw ()

void                evd_buffered_input_stream_thaw      (EvdBufferedInputStream *self,
                                                         gint priority);