const GValue *value,
GParamSpec *pspec)
{
- GDataInputStreamPrivate *priv;
GDataInputStream *dstream;
dstream = G_DATA_INPUT_STREAM (object);
- priv = dstream->priv;
- switch (prop_id)
+ switch (prop_id)
{
case PROP_BYTE_ORDER:
g_data_input_stream_set_byte_order (dstream, g_value_get_enum (value));
* Reads a 16-bit/2-byte value from @stream.
*
* In order to get the correct byte order for this read operation,
- * see g_data_stream_get_byte_order() and g_data_stream_set_byte_order().
+ * see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
*
* Returns: a signed 16-bit/2-byte value read from @stream or %0 if
* an error occurred.
* Reads an unsigned 16-bit/2-byte value from @stream.
*
* In order to get the correct byte order for this read operation,
- * see g_data_stream_get_byte_order() and g_data_stream_set_byte_order().
+ * see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
*
* Returns: an unsigned 16-bit/2-byte value read from the @stream or %0 if
* an error occurred.
* Reads a signed 32-bit/4-byte value from @stream.
*
* In order to get the correct byte order for this read operation,
- * see g_data_stream_get_byte_order() and g_data_stream_set_byte_order().
+ * see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
*
* If @cancellable is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* Reads an unsigned 32-bit/4-byte value from @stream.
*
* In order to get the correct byte order for this read operation,
- * see g_data_stream_get_byte_order() and g_data_stream_set_byte_order().
+ * see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
*
* If @cancellable is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* Reads a 64-bit/8-byte value from @stream.
*
* In order to get the correct byte order for this read operation,
- * see g_data_stream_get_byte_order() and g_data_stream_set_byte_order().
+ * see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
*
* If @cancellable is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* Reads an unsigned 64-bit/8-byte value from @stream.
*
* In order to get the correct byte order for this read operation,
- * see g_data_stream_get_byte_order().
+ * see g_data_input_stream_get_byte_order().
*
* If @cancellable is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* @error: #GError for error reporting.
*
* Reads a line from the data input stream.
- *
+ *
* 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 %G_IO_ERROR_CANCELLED will be returned.
- *
+ * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
+ *
* Returns: a string with the line that was read in (without the newlines).
- * Set @length to a #gsize to get the length of the read line.
- * On an error, it will return %NULL and @error will be set. If there's no
- * content to read, it will still return %NULL, but @error won't be set.
+ * Set @length to a #gsize to get the length of the read line.
+ * On an error, it will return %NULL and @error will be set. If there's no
+ * content to read, it will still return %NULL, but @error won't be set.
**/
char *
g_data_input_stream_read_line (GDataInputStream *stream,
const char *stop_chars)
{
GBufferedInputStream *bstream;
- GDataInputStreamPrivate *priv;
const char *buffer;
gsize start, end, peeked;
int i;
- gssize found_pos;
gsize available, checked;
const char *stop_char;
- priv = stream->priv;
-
bstream = G_BUFFERED_INPUT_STREAM (stream);
checked = *checked_out;
- found_pos = -1;
-
+
start = checked;
buffer = (const char *)g_buffered_input_stream_peek_buffer (bstream, &available) + start;
end = available;
* @length: a #gsize to get the length of the data read in.
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting.
- *
- * Reads a string from the data input stream, up to the first
+ *
+ * Reads a string from the data input stream, up to the first
* occurrence of any of the stop characters.
*
- * Returns: a string with the data that was read before encountering
- * any of the stop characters. Set @length to a #gsize to get the length
- * of the string. This function will return %NULL on an error.
- **/
+ * Note that, in contrast to g_data_input_stream_read_until_async(),
+ * this function consumes the stop character that it finds.
+ *
+ * Returns: a string with the data that was read before encountering
+ * any of the stop characters. Set @length to a #gsize to get the length
+ * of the string. This function will return %NULL on an error.
+ */
char *
g_data_input_stream_read_until (GDataInputStream *stream,
const gchar *stop_chars,
/**
* g_data_input_stream_read_line_async:
* @stream: a given #GDataInputStream.
- * @io_priority: the <link linkend="io-priority">I/O priority</link>
- * of the request.
+ * @io_priority: the <link linkend="io-priority">I/O priority</link>
+ * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @callback: callback to call when the request is satisfied.
* @user_data: the data to pass to callback function.
* The asynchronous version of g_data_input_stream_read_line(). It is
* an error to have two outstanding calls to this function.
*
+ * When the operation is finished, @callback will be called. You
+ * can then call g_data_input_stream_read_line_finish() to get
+ * the result of the operation.
+ *
* Since: 2.20
*/
void
* g_data_input_stream_read_until_async:
* @stream: a given #GDataInputStream.
* @stop_chars: characters to terminate the read.
- * @io_priority: the <link linkend="io-priority">I/O priority</link>
- * of the request.
+ * @io_priority: the <link linkend="io-priority">I/O priority</link>
+ * of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @callback: callback to call when the request is satisfied.
* @user_data: the data to pass to callback function.
* The asynchronous version of g_data_input_stream_read_until().
* It is an error to have two outstanding calls to this function.
*
+ * Note that, in contrast to g_data_input_stream_read_until(),
+ * this function does not consume the stop character that it finds. You
+ * must read it for yourself.
+ *
+ * When the operation is finished, @callback will be called. You
+ * can then call g_data_input_stream_read_until_finish() to get
+ * the result of the operation.
+ *
* Since: 2.20
*/
void
* Finish an asynchronous call started by
* g_data_input_stream_read_line_async().
*
- * Since: 2,20
+ * Returns: a string with the line that was read in (without the newlines).
+ * Set @length to a #gsize to get the length of the read line.
+ * On an error, it will return %NULL and @error will be set. If there's no
+ * content to read, it will still return %NULL, but @error won't be set.
+ *
+ * Since: 2.20
*/
gchar *
g_data_input_stream_read_line_finish (GDataInputStream *stream,
* g_data_input_stream_read_until_async().
*
* Since: 2.20
+ *
+ * Returns: a string with the data that was read before encountering
+ * any of the stop characters. Set @length to a #gsize to get the length
+ * of the string. This function will return %NULL on an error.
*/
gchar *
g_data_input_stream_read_until_finish (GDataInputStream *stream,
return g_data_input_stream_read_finish (stream, result, length, error);
}
+
#define __G_DATA_INPUT_STREAM_C__
#include "gioaliasdef.c"