You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

124 lines
4.9 KiB

  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2006-2007 Red Hat, Inc.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General
  16. * Public License along with this library; if not, write to the
  17. * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  18. * Boston, MA 02111-1307, USA.
  19. *
  20. * Author: Christian Kellner <gicmo@gnome.org>
  21. */
  22. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  23. #error "Only <gio/gio.h> can be included directly."
  24. #endif
  25. #ifndef __G_BUFFERED_INPUT_STREAM_H__
  26. #define __G_BUFFERED_INPUT_STREAM_H__
  27. #include <gio/gfilterinputstream.h>
  28. G_BEGIN_DECLS
  29. #define G_TYPE_BUFFERED_INPUT_STREAM (g_buffered_input_stream_get_type ())
  30. #define G_BUFFERED_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_BUFFERED_INPUT_STREAM, GBufferedInputStream))
  31. #define G_BUFFERED_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_BUFFERED_INPUT_STREAM, GBufferedInputStreamClass))
  32. #define G_IS_BUFFERED_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_BUFFERED_INPUT_STREAM))
  33. #define G_IS_BUFFERED_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_BUFFERED_INPUT_STREAM))
  34. #define G_BUFFERED_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_BUFFERED_INPUT_STREAM, GBufferedInputStreamClass))
  35. /**
  36. * GBufferedInputStream:
  37. *
  38. * Implements #GFilterInputStream with a sized input buffer.
  39. **/
  40. typedef struct _GBufferedInputStreamClass GBufferedInputStreamClass;
  41. typedef struct _GBufferedInputStreamPrivate GBufferedInputStreamPrivate;
  42. struct _GBufferedInputStream
  43. {
  44. GFilterInputStream parent_instance;
  45. /*< private >*/
  46. GBufferedInputStreamPrivate *priv;
  47. };
  48. struct _GBufferedInputStreamClass
  49. {
  50. GFilterInputStreamClass parent_class;
  51. gssize (* fill) (GBufferedInputStream *stream,
  52. gssize count,
  53. GCancellable *cancellable,
  54. GError **error);
  55. /* Async ops: (optional in derived classes) */
  56. void (* fill_async) (GBufferedInputStream *stream,
  57. gssize count,
  58. int io_priority,
  59. GCancellable *cancellable,
  60. GAsyncReadyCallback callback,
  61. gpointer user_data);
  62. gssize (* fill_finish) (GBufferedInputStream *stream,
  63. GAsyncResult *result,
  64. GError **error);
  65. /*< private >*/
  66. /* Padding for future expansion */
  67. void (*_g_reserved1) (void);
  68. void (*_g_reserved2) (void);
  69. void (*_g_reserved3) (void);
  70. void (*_g_reserved4) (void);
  71. void (*_g_reserved5) (void);
  72. };
  73. GType g_buffered_input_stream_get_type (void) G_GNUC_CONST;
  74. GInputStream* g_buffered_input_stream_new (GInputStream *base_stream);
  75. GInputStream* g_buffered_input_stream_new_sized (GInputStream *base_stream,
  76. gsize size);
  77. gsize g_buffered_input_stream_get_buffer_size (GBufferedInputStream *stream);
  78. void g_buffered_input_stream_set_buffer_size (GBufferedInputStream *stream,
  79. gsize size);
  80. gsize g_buffered_input_stream_get_available (GBufferedInputStream *stream);
  81. gsize g_buffered_input_stream_peek (GBufferedInputStream *stream,
  82. void *buffer,
  83. gsize offset,
  84. gsize count);
  85. const void* g_buffered_input_stream_peek_buffer (GBufferedInputStream *stream,
  86. gsize *count);
  87. gssize g_buffered_input_stream_fill (GBufferedInputStream *stream,
  88. gssize count,
  89. GCancellable *cancellable,
  90. GError **error);
  91. void g_buffered_input_stream_fill_async (GBufferedInputStream *stream,
  92. gssize count,
  93. int io_priority,
  94. GCancellable *cancellable,
  95. GAsyncReadyCallback callback,
  96. gpointer user_data);
  97. gssize g_buffered_input_stream_fill_finish (GBufferedInputStream *stream,
  98. GAsyncResult *result,
  99. GError **error);
  100. int g_buffered_input_stream_read_byte (GBufferedInputStream *stream,
  101. GCancellable *cancellable,
  102. GError **error);
  103. G_END_DECLS
  104. #endif /* __G_BUFFERED_INPUT_STREAM_H__ */