Package ch.bailu.gtk.gio
Klasse MemoryOutputStream
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.type.PropertyHolder
ch.bailu.gtk.gio.OutputStream
ch.bailu.gtk.gio.MemoryOutputStream
- Alle implementierten Schnittstellen:
PointerInterface
`GMemoryOutputStream` is a class for using arbitrary
memory chunks as output for GIO streaming output operations.
As of GLib 2.34, `GMemoryOutputStream` trivially implements
[iface@Gio.PollableOutputStream]: it always polls as ready.
memory chunks as output for GIO streaming output operations.
As of GLib 2.34, `GMemoryOutputStream` trivially implements
[iface@Gio.PollableOutputStream]: it always polls as ready.
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic interface
static interface
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gio.OutputStream
OutputStream.OnAsyncReadyCallback
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
Von Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungMemoryOutputStream
(PointerContainer pointer) MemoryOutputStream
(Pointer data, long size, MemoryOutputStream.OnReallocFunc realloc_function, MemoryOutputStream.OnDestroyNotify destroy_function) Creates a new #GMemoryOutputStream. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungImplements interfacePollableOutputStream
.Implements interfaceSeekable
.static ClassHandler
getData()
Gets any loaded data from the @ostream.long
Returns the number of bytes from the start up to including the last
byte written in the stream that has not been truncated away.static int
static long
static TypeSystem.TypeSize
long
getSize()
Gets the size of the currently allocated data area (available from
g_memory_output_stream_get_data()).static long
static TypeSystem.TypeSize
static MemoryOutputStream
Creates a new #GMemoryOutputStream, using g_realloc() and g_free()
for memory allocation.Returns data from the @ostream as a #GBytes.Gets any loaded data from the @ostream.Von Klasse geerbte Methoden ch.bailu.gtk.gio.OutputStream
clearPending, close, closeAsync, closeFinish, flush, flushAsync, flushFinish, hasPending, isClosed, isClosing, setPending, splice, spliceAsync, spliceFinish, write, writeAll, writeAllAsync, writeAllFinish, writeAsync, writeBytes, writeBytesAsync, writeBytesFinish, writeFinish, writevAllFinish, writevFinish
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
-
MemoryOutputStream
-
MemoryOutputStream
public MemoryOutputStream(@Nullable Pointer data, long size, MemoryOutputStream.OnReallocFunc realloc_function, MemoryOutputStream.OnDestroyNotify destroy_function) Creates a new #GMemoryOutputStream.
In most cases this is not the function you want. See
g_memory_output_stream_new_resizable() instead.
If @data is non-%NULL, the stream will use that for its internal storage.
If @realloc_fn is non-%NULL, it will be used for resizing the internal
storage when necessary and the stream will be considered resizable.
In that case, the stream will start out being (conceptually) empty.
@size is used only as a hint for how big @data is. Specifically,
seeking to the end of a newly-created stream will seek to zero, not
@size. Seeking past the end of the stream and then writing will
introduce a zero-filled gap.
If @realloc_fn is %NULL then the stream is fixed-sized. Seeking to
the end will seek to @size exactly. Writing past the end will give
an 'out of space' error. Attempting to seek past the end will fail.
Unlike the resizable case, seeking to an offset within the stream and
writing will preserve the bytes passed in as @data before that point
and will return them as part of g_memory_output_stream_steal_data().
If you intend to seek you should probably therefore ensure that @data
is properly initialised.
It is probably only meaningful to provide @data and @size in the case
that you want a fixed-sized stream. Put another way: if @realloc_fn
is non-%NULL then it makes most sense to give @data as %NULL and
@size as 0 (allowing #GMemoryOutputStream to do the initial
allocation for itself).
<!-- language="C" --> // a stream that can grow stream = g_memory_output_stream_new (NULL, 0, realloc, free); // another stream that can grow stream2 = g_memory_output_stream_new (NULL, 0, g_realloc, g_free); // a fixed-size stream data = malloc (200); stream3 = g_memory_output_stream_new (data, 200, NULL, free);
- Parameter:
data
- pointer to a chunk of memory to use, or %NULLsize
- the size of @datarealloc_function
- a function with realloc() semantics (like g_realloc()) to be called when @data needs to be grown, or %NULLdestroy_function
- a function to be called on @data when the stream is finalized, or %NULL
-
-
Methodendetails
-
getClassHandler
-
newResizableMemoryOutputStream
Creates a new #GMemoryOutputStream, using g_realloc() and g_free()
for memory allocation.- Gibt zurück:
-
getData
Gets any loaded data from the @ostream.
Note that the returned pointer may become invalid on the next
write or truncate operation on the stream.- Gibt zurück:
- pointer to the stream's data, or %NULL if the data has been stolen
-
getDataSize
public long getDataSize()Returns the number of bytes from the start up to including the last
byte written in the stream that has not been truncated away.- Gibt zurück:
- the number of bytes written to the stream
-
getSize
public long getSize()Gets the size of the currently allocated data area (available from
g_memory_output_stream_get_data()).
You probably don't want to use this function on resizable streams.
See g_memory_output_stream_get_data_size() instead. For resizable
streams the size returned by this function is an implementation
detail and may be change at any time in response to operations on the
stream.
If the stream is fixed-sized (ie: no realloc was passed to
g_memory_output_stream_new()) then this is the maximum size of the
stream and further writes will return %G_IO_ERROR_NO_SPACE.
In any case, if you want the number of bytes currently written to the
stream, use g_memory_output_stream_get_data_size().- Gibt zurück:
- the number of bytes allocated for the data buffer
-
stealAsBytes
Returns data from the @ostream as a #GBytes. @ostream must be
closed before calling this function.- Gibt zurück:
- the stream's data
-
stealData
Gets any loaded data from the @ostream. Ownership of the data
is transferred to the caller; when no longer needed it must be
freed using the free function set in @ostream's
#GMemoryOutputStream:destroy-function property.
@ostream must be closed before calling this function.- Gibt zurück:
- the stream's data, or %NULL if it has previously been stolen
-
asPollableOutputStream
Implements interfacePollableOutputStream
. Call this to get access to interface functions.- Gibt zurück:
PollableOutputStream
-
asSeekable
Implements interfaceSeekable
. Call this to get access to interface functions.- Gibt zurück:
Seekable
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-