Trait gio::prelude::DataInputStreamExt
source · pub trait DataInputStreamExt: IsA<DataInputStream> + Sealed + 'static {
Show 13 methods
// Provided methods
fn byte_order(&self) -> DataStreamByteOrder { ... }
fn newline_type(&self) -> DataStreamNewlineType { ... }
fn read_byte(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<u8, Error> { ... }
fn read_int16(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<i16, Error> { ... }
fn read_int32(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<i32, Error> { ... }
fn read_int64(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<i64, Error> { ... }
fn read_uint16(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<u16, Error> { ... }
fn read_uint32(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<u32, Error> { ... }
fn read_uint64(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<u64, Error> { ... }
fn set_byte_order(&self, order: DataStreamByteOrder) { ... }
fn set_newline_type(&self, type_: DataStreamNewlineType) { ... }
fn connect_byte_order_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_newline_type_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Expand description
Provided Methods§
sourcefn byte_order(&self) -> DataStreamByteOrder
fn byte_order(&self) -> DataStreamByteOrder
sourcefn newline_type(&self) -> DataStreamNewlineType
fn newline_type(&self) -> DataStreamNewlineType
sourcefn read_int16(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<i16, Error>
fn read_int16( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<i16, Error>
Reads a 16-bit/2-byte value from @self.
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().
§cancellable
optional #GCancellable object, None
to ignore.
§Returns
a signed 16-bit/2-byte value read from @self or 0
if
an error occurred.
sourcefn read_int32(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<i32, Error>
fn read_int32( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<i32, Error>
Reads a signed 32-bit/4-byte value from @self.
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 None
, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error IOErrorEnum::Cancelled
will be returned.
§cancellable
optional #GCancellable object, None
to ignore.
§Returns
a signed 32-bit/4-byte value read from the @self or 0
if
an error occurred.
sourcefn read_int64(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<i64, Error>
fn read_int64( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<i64, Error>
Reads a 64-bit/8-byte value from @self.
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 None
, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error IOErrorEnum::Cancelled
will be returned.
§cancellable
optional #GCancellable object, None
to ignore.
§Returns
a signed 64-bit/8-byte value read from @self or 0
if
an error occurred.
sourcefn read_uint16(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<u16, Error>
fn read_uint16( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<u16, Error>
Reads an unsigned 16-bit/2-byte value from @self.
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().
§cancellable
optional #GCancellable object, None
to ignore.
§Returns
an unsigned 16-bit/2-byte value read from the @self or 0
if
an error occurred.
sourcefn read_uint32(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<u32, Error>
fn read_uint32( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<u32, Error>
Reads an unsigned 32-bit/4-byte value from @self.
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 None
, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error IOErrorEnum::Cancelled
will be returned.
§cancellable
optional #GCancellable object, None
to ignore.
§Returns
an unsigned 32-bit/4-byte value read from the @self or 0
if
an error occurred.
sourcefn read_uint64(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<u64, Error>
fn read_uint64( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<u64, Error>
Reads an unsigned 64-bit/8-byte value from @self.
In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order().
If @cancellable is not None
, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error IOErrorEnum::Cancelled
will be returned.
§cancellable
optional #GCancellable object, None
to ignore.
§Returns
an unsigned 64-bit/8-byte read from @self or 0
if
an error occurred.
sourcefn set_byte_order(&self, order: DataStreamByteOrder)
fn set_byte_order(&self, order: DataStreamByteOrder)
This function sets the byte order for the given @self. All subsequent reads from the @self will be read in the given @order.
§order
a #GDataStreamByteOrder to set.
sourcefn set_newline_type(&self, type_: DataStreamNewlineType)
fn set_newline_type(&self, type_: DataStreamNewlineType)
Sets the newline type for the @self.
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.
§type_
the type of new line return as #GDataStreamNewlineType.