Package ch.bailu.gtk.gio
Klasse DataInputStream
- Alle implementierten Schnittstellen:
PointerInterface
Data input stream implements [class@Gio.InputStream] and includes functions
for reading structured data directly from a binary input stream.
for reading structured data directly from a binary input stream.
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenVon Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
Von Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungDataInputStream
(InputStream base_stream) Creates a new data input stream for the @base_stream.DataInputStream
(PointerContainer pointer) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungImplements interfaceSeekable
.int
Gets the byte order for the data input stream.static ClassHandler
static int
int
Gets the current newline type for the @stream.static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
int
readInt16
(Cancellable cancellable) Reads a 16-bit/2-byte value from @stream.int
readInt32
(Cancellable cancellable) Reads a signed 32-bit/4-byte value from @stream.long
readInt64
(Cancellable cancellable) Reads a 64-bit/8-byte value from @stream.readLine
(Int64 length, Cancellable cancellable) Reads a line from the data input stream.void
readLineAsync
(int io_priority, Cancellable cancellable, DataInputStream.OnAsyncReadyCallback callback, Pointer user_data) The asynchronous version of g_data_input_stream_read_line().readLineFinish
(AsyncResult result, Int64 length) Finish an asynchronous call started by
g_data_input_stream_read_line_async().readLineFinishUtf8
(AsyncResult result, Int64 length) Finish an asynchronous call started by
g_data_input_stream_read_line_async().readLineUtf8
(Int64 length, Cancellable cancellable) Reads a UTF-8 encoded line from the data input stream.int
readUint16
(Cancellable cancellable) Reads an unsigned 16-bit/2-byte value from @stream.int
readUint32
(Cancellable cancellable) Reads an unsigned 32-bit/4-byte value from @stream.long
readUint64
(Cancellable cancellable) Reads an unsigned 64-bit/8-byte value from @stream.readUntil
(Str stop_chars, Int64 length, Cancellable cancellable) Veraltet.readUntil
(String stop_chars, Int64 length, Cancellable cancellable) Veraltet.void
readUntilAsync
(Str stop_chars, int io_priority, Cancellable cancellable, DataInputStream.OnAsyncReadyCallback callback, Pointer user_data) Veraltet.void
readUntilAsync
(String stop_chars, int io_priority, Cancellable cancellable, DataInputStream.OnAsyncReadyCallback callback, Pointer user_data) Veraltet.readUntilFinish
(AsyncResult result, Int64 length) Veraltet.readUpto
(Str stop_chars, long stop_chars_len, Int64 length, Cancellable cancellable) Reads a string from the data input stream, up to the first
occurrence of any of the stop characters.readUpto
(String stop_chars, long stop_chars_len, Int64 length, Cancellable cancellable) Reads a string from the data input stream, up to the first
occurrence of any of the stop characters.void
readUptoAsync
(Str stop_chars, long stop_chars_len, int io_priority, Cancellable cancellable, DataInputStream.OnAsyncReadyCallback callback, Pointer user_data) The asynchronous version of g_data_input_stream_read_upto().void
readUptoAsync
(String stop_chars, long stop_chars_len, int io_priority, Cancellable cancellable, DataInputStream.OnAsyncReadyCallback callback, Pointer user_data) The asynchronous version of g_data_input_stream_read_upto().readUptoFinish
(AsyncResult result, Int64 length) Finish an asynchronous call started by
g_data_input_stream_read_upto_async().void
setByteOrder
(int order) This function sets the byte order for the given @stream.void
setNewlineType
(int type) Sets the newline type for the @stream.Von Klasse geerbte Methoden ch.bailu.gtk.gio.BufferedInputStream
fill, fillAsync, fillFinish, getAvailable, getBufferSize, newSizedBufferedInputStream, peek, peekBuffer, readByte, setBufferSize
Von Klasse geerbte Methoden ch.bailu.gtk.gio.FilterInputStream
getBaseStream, getCloseBaseStream, setCloseBaseStream
Von Klasse geerbte Methoden ch.bailu.gtk.gio.InputStream
clearPending, close, closeAsync, closeFinish, hasPending, isClosed, read, readAll, readAllAsync, readAllFinish, readAsync, readBytes, readBytesAsync, readBytesFinish, readFinish, setPending, skip, skipAsync, skipFinish
Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Konstruktordetails
-
DataInputStream
-
DataInputStream
Creates a new data input stream for the @base_stream.- Parameter:
base_stream
- a #GInputStream.
-
-
Methodendetails
-
getClassHandler
-
getByteOrder
public int getByteOrder()Gets the byte order for the data input stream.- Gibt zurück:
- the @stream's current #GDataStreamByteOrder.
-
getNewlineType
public int getNewlineType()Gets the current newline type for the @stream.- Gibt zurück:
- #GDataStreamNewlineType for the given @stream.
-
readInt16
Reads a 16-bit/2-byte value from @stream.
In order to get the correct byte order for this read operation,
see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().- Parameter:
cancellable
- optional #GCancellable object, %NULL to ignore.- Gibt zurück:
- a signed 16-bit/2-byte value read from @stream or `0` if an error occurred.
- Löst aus:
AllocationError
-
readInt32
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_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
was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.- Parameter:
cancellable
- optional #GCancellable object, %NULL to ignore.- Gibt zurück:
- a signed 32-bit/4-byte value read from the @stream or `0` if an error occurred.
- Löst aus:
AllocationError
-
readInt64
Reads a 64-bit/8-byte value from @stream.
In order to get the correct byte order for this read operation,
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
was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.- Parameter:
cancellable
- optional #GCancellable object, %NULL to ignore.- Gibt zurück:
- a signed 64-bit/8-byte value read from @stream or `0` if an error occurred.
- Löst aus:
AllocationError
-
readLine
public Str readLine(@Nullable Int64 length, @Nullable Cancellable cancellable) throws AllocationError Reads a line from the data input stream. Note that no encoding
checks or conversion is performed; the input is not guaranteed to
be UTF-8, and may in fact have embedded NUL characters.
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.- Parameter:
length
- a #gsize to get the length of the data read in.cancellable
- optional #GCancellable object, %NULL to ignore.- Gibt zurück:
- a NUL terminated byte array 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.
- Löst aus:
AllocationError
-
readLineAsync
public void readLineAsync(int io_priority, @Nullable Cancellable cancellable, DataInputStream.OnAsyncReadyCallback callback, @Nullable Pointer user_data) 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.- Parameter:
io_priority
- the [I/O priority](iface.AsyncResult.html#io-priority) of the requestcancellable
- optional #GCancellable object, %NULL to ignore.callback
- callback to call when the request is satisfied.user_data
- the data to pass to callback function.
-
readLineFinish
public Str readLineFinish(@Nonnull AsyncResult result, @Nullable Int64 length) throws AllocationError Finish an asynchronous call started by
g_data_input_stream_read_line_async(). Note the warning about
string encoding in g_data_input_stream_read_line() applies here as
well.- Parameter:
result
- the #GAsyncResult that was provided to the callback.length
- a #gsize to get the length of the data read in.- Gibt zurück:
- a NUL-terminated byte array 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.
- Löst aus:
AllocationError
-
readLineFinishUtf8
public Str readLineFinishUtf8(@Nonnull AsyncResult result, @Nullable Int64 length) throws AllocationError Finish an asynchronous call started by
g_data_input_stream_read_line_async().- Parameter:
result
- the #GAsyncResult that was provided to the callback.length
- a #gsize to get the length of the data read in.- Gibt zurück:
- 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. For UTF-8 conversion errors, the set error domain is %G_CONVERT_ERROR. If there's no content to read, it will still return %NULL, but @error won't be set.
- Löst aus:
AllocationError
-
readLineUtf8
public Str readLineUtf8(@Nullable Int64 length, @Nullable Cancellable cancellable) throws AllocationError Reads a UTF-8 encoded 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.- Parameter:
length
- a #gsize to get the length of the data read in.cancellable
- optional #GCancellable object, %NULL to ignore.- Gibt zurück:
- a NUL terminated UTF-8 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. For UTF-8 conversion errors, the set error domain is %G_CONVERT_ERROR. If there's no content to read, it will still return %NULL, but @error won't be set.
- Löst aus:
AllocationError
-
readUint16
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_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().- Parameter:
cancellable
- optional #GCancellable object, %NULL to ignore.- Gibt zurück:
- an unsigned 16-bit/2-byte value read from the @stream or `0` if an error occurred.
- Löst aus:
AllocationError
-
readUint32
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_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
was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.- Parameter:
cancellable
- optional #GCancellable object, %NULL to ignore.- Gibt zurück:
- an unsigned 32-bit/4-byte value read from the @stream or `0` if an error occurred.
- Löst aus:
AllocationError
-
readUint64
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_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
was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.- Parameter:
cancellable
- optional #GCancellable object, %NULL to ignore.- Gibt zurück:
- an unsigned 64-bit/8-byte read from @stream or `0` if an error occurred.
- Löst aus:
AllocationError
-
readUntil
@Deprecated public Str readUntil(@Nonnull Str stop_chars, @Nullable Int64 length, @Nullable Cancellable cancellable) throws AllocationError Veraltet.Reads a string from the data input stream, up to the first
occurrence of any of the stop characters.
Note that, in contrast to g_data_input_stream_read_until_async(),
this function consumes the stop character that it finds.
Don't use this function in new code. Its functionality is
inconsistent with g_data_input_stream_read_until_async(). Both
functions will be marked as deprecated in a future release. Use
g_data_input_stream_read_upto() instead, but note that that function
does not consume the stop character.- Parameter:
stop_chars
- characters to terminate the read.length
- a #gsize to get the length of the data read in.cancellable
- optional #GCancellable object, %NULL to ignore.- Gibt zurück:
- 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.
- Löst aus:
AllocationError
-
readUntil
@Deprecated public Str readUntil(String stop_chars, @Nullable Int64 length, @Nullable Cancellable cancellable) throws AllocationError Veraltet.Reads a string from the data input stream, up to the first
occurrence of any of the stop characters.
Note that, in contrast to g_data_input_stream_read_until_async(),
this function consumes the stop character that it finds.
Don't use this function in new code. Its functionality is
inconsistent with g_data_input_stream_read_until_async(). Both
functions will be marked as deprecated in a future release. Use
g_data_input_stream_read_upto() instead, but note that that function
does not consume the stop character.- Parameter:
stop_chars
- characters to terminate the read.length
- a #gsize to get the length of the data read in.cancellable
- optional #GCancellable object, %NULL to ignore.- Gibt zurück:
- 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.
- Löst aus:
AllocationError
-
readUntilAsync
@Deprecated public void readUntilAsync(@Nonnull Str stop_chars, int io_priority, @Nullable Cancellable cancellable, DataInputStream.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Veraltet.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.
Don't use this function in new code. Its functionality is
inconsistent with g_data_input_stream_read_until(). Both functions
will be marked as deprecated in a future release. Use
g_data_input_stream_read_upto_async() instead.- Parameter:
stop_chars
- characters to terminate the read.io_priority
- the [I/O priority](iface.AsyncResult.html#io-priority) of the requestcancellable
- optional #GCancellable object, %NULL to ignore.callback
- callback to call when the request is satisfied.user_data
- the data to pass to callback function.
-
readUntilAsync
@Deprecated public void readUntilAsync(String stop_chars, int io_priority, @Nullable Cancellable cancellable, DataInputStream.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Veraltet.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.
Don't use this function in new code. Its functionality is
inconsistent with g_data_input_stream_read_until(). Both functions
will be marked as deprecated in a future release. Use
g_data_input_stream_read_upto_async() instead.- Parameter:
stop_chars
- characters to terminate the read.io_priority
- the [I/O priority](iface.AsyncResult.html#io-priority) of the requestcancellable
- optional #GCancellable object, %NULL to ignore.callback
- callback to call when the request is satisfied.user_data
- the data to pass to callback function.
-
readUntilFinish
@Deprecated public Str readUntilFinish(@Nonnull AsyncResult result, @Nullable Int64 length) throws AllocationError Veraltet.Finish an asynchronous call started by
g_data_input_stream_read_until_async().- Parameter:
result
- the #GAsyncResult that was provided to the callback.length
- a #gsize to get the length of the data read in.- Gibt zurück:
- 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.
- Löst aus:
AllocationError
-
readUpto
public Str readUpto(@Nonnull Str stop_chars, long stop_chars_len, @Nullable Int64 length, @Nullable Cancellable cancellable) throws AllocationError Reads a string from the data input stream, up to the first
occurrence of any of the stop characters.
In contrast to g_data_input_stream_read_until(), this function
does not consume the stop character. You have to use
g_data_input_stream_read_byte() to get it before calling
g_data_input_stream_read_upto() again.
Note that @stop_chars may contain '\0' if @stop_chars_len is
specified.
The returned string will always be nul-terminated on success.- Parameter:
stop_chars
- characters to terminate the readstop_chars_len
- length of @stop_chars. May be -1 if @stop_chars is nul-terminatedlength
- a #gsize to get the length of the data read incancellable
- optional #GCancellable object, %NULL to ignore- Gibt zurück:
- 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
- Löst aus:
AllocationError
-
readUpto
public Str readUpto(String stop_chars, long stop_chars_len, @Nullable Int64 length, @Nullable Cancellable cancellable) throws AllocationError Reads a string from the data input stream, up to the first
occurrence of any of the stop characters.
In contrast to g_data_input_stream_read_until(), this function
does not consume the stop character. You have to use
g_data_input_stream_read_byte() to get it before calling
g_data_input_stream_read_upto() again.
Note that @stop_chars may contain '\0' if @stop_chars_len is
specified.
The returned string will always be nul-terminated on success.- Parameter:
stop_chars
- characters to terminate the readstop_chars_len
- length of @stop_chars. May be -1 if @stop_chars is nul-terminatedlength
- a #gsize to get the length of the data read incancellable
- optional #GCancellable object, %NULL to ignore- Gibt zurück:
- 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
- Löst aus:
AllocationError
-
readUptoAsync
public void readUptoAsync(@Nonnull Str stop_chars, long stop_chars_len, int io_priority, @Nullable Cancellable cancellable, DataInputStream.OnAsyncReadyCallback callback, @Nullable Pointer user_data) The asynchronous version of g_data_input_stream_read_upto().
It is an error to have two outstanding calls to this function.
In contrast to g_data_input_stream_read_until(), this function
does not consume the stop character. You have to use
g_data_input_stream_read_byte() to get it before calling
g_data_input_stream_read_upto() again.
Note that @stop_chars may contain '\0' if @stop_chars_len is
specified.
When the operation is finished, @callback will be called. You
can then call g_data_input_stream_read_upto_finish() to get
the result of the operation.- Parameter:
stop_chars
- characters to terminate the readstop_chars_len
- length of @stop_chars. May be -1 if @stop_chars is nul-terminatedio_priority
- the [I/O priority](iface.AsyncResult.html#io-priority) of the requestcancellable
- optional #GCancellable object, %NULL to ignorecallback
- callback to call when the request is satisfieduser_data
- the data to pass to callback function
-
readUptoAsync
public void readUptoAsync(String stop_chars, long stop_chars_len, int io_priority, @Nullable Cancellable cancellable, DataInputStream.OnAsyncReadyCallback callback, @Nullable Pointer user_data) The asynchronous version of g_data_input_stream_read_upto().
It is an error to have two outstanding calls to this function.
In contrast to g_data_input_stream_read_until(), this function
does not consume the stop character. You have to use
g_data_input_stream_read_byte() to get it before calling
g_data_input_stream_read_upto() again.
Note that @stop_chars may contain '\0' if @stop_chars_len is
specified.
When the operation is finished, @callback will be called. You
can then call g_data_input_stream_read_upto_finish() to get
the result of the operation.- Parameter:
stop_chars
- characters to terminate the readstop_chars_len
- length of @stop_chars. May be -1 if @stop_chars is nul-terminatedio_priority
- the [I/O priority](iface.AsyncResult.html#io-priority) of the requestcancellable
- optional #GCancellable object, %NULL to ignorecallback
- callback to call when the request is satisfieduser_data
- the data to pass to callback function
-
readUptoFinish
public Str readUptoFinish(@Nonnull AsyncResult result, @Nullable Int64 length) throws AllocationError Finish an asynchronous call started by
g_data_input_stream_read_upto_async().
Note that this function does not consume the stop character. You
have to use g_data_input_stream_read_byte() to get it before calling
g_data_input_stream_read_upto_async() again.
The returned string will always be nul-terminated on success.- Parameter:
result
- the #GAsyncResult that was provided to the callbacklength
- a #gsize to get the length of the data read in- Gibt zurück:
- 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.
- Löst aus:
AllocationError
-
setByteOrder
public void setByteOrder(int order) This function sets the byte order for the given @stream. All subsequent
reads from the @stream will be read in the given @order.- Parameter:
order
- a #GDataStreamByteOrder to set.
-
setNewlineType
public void setNewlineType(int type) Sets the newline type for the @stream.
Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read
chunk ends in "CR" we must read an additional byte to know if this is "CR" or
"CR LF", and this might block if there is no more data available.- Parameter:
type
- the type of new line return as #GDataStreamNewlineType.
-
asSeekable
Implements interfaceSeekable
. Call this to get access to interface functions.- Setzt außer Kraft:
asSeekable
in KlasseBufferedInputStream
- Gibt zurück:
Seekable
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-