Class ContentSerializer
- All Implemented Interfaces:
Proxy
,AsyncResult
GdkContentSerializer
is used to serialize content for
inter-application data transfers.
The GdkContentSerializer
transforms an object that is identified
by a GType into a serialized form (i.e. a byte stream) that is
identified by a mime type.
GTK provides serializers and deserializers for common data types
such as text, colors, images or file lists. To register your own
serialization functions, use Gdk.contentRegisterSerializer(org.gnome.glib.Type, java.lang.String, org.gnome.gdk.ContentSerializeFunc)
.
Also see ContentDeserializer
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
ContentSerializer.Builder<B extends ContentSerializer.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
Nested classes/interfaces inherited from interface org.gnome.gio.AsyncResult
AsyncResult.AsyncResultIface, AsyncResult.AsyncResultImpl
-
Constructor Summary
ConstructorDescriptionContentSerializer
(MemorySegment address) Create a ContentSerializer proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ContentSerializer
asParent()
Returns this instance as if it were its parent type.static ContentSerializer.Builder
<? extends ContentSerializer.Builder> builder()
AContentSerializer.Builder
object constructs aContentSerializer
with the specified properties.Gets the cancellable for the current operation.getGtype()
Gets theGType
to of the object to serialize.Gets the mime type to serialize to.Gets the output stream for the current operation.int
Gets the I/O priority for the current operation.Gets the data that was associated with the current operation.static Type
getType()
Get the GType of the ContentSerializer classGets the user data that was passed when the serializer was registered.getValue()
Gets theGValue
to read the object to serialize from.void
returnError
(GError error) Indicate that the serialization has ended with an error.void
Indicate that the serialization has been successfully completed.void
setTaskData
(@Nullable MemorySegment data) Associate data with the current serialization operation.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gio.AsyncResult
getSourceObject, isTagged, legacyPropagateError
-
Constructor Details
-
ContentSerializer
Create a ContentSerializer proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getCancellable
Gets the cancellable for the current operation.This is the
GCancellable
that was passed toGdk.contentSerializeAsync(org.gnome.gio.OutputStream, java.lang.String, org.gnome.gobject.Value, int, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)
.- Returns:
- the cancellable for the current operation
-
getGtype
Gets theGType
to of the object to serialize.- Returns:
- the
GType
for the current operation
-
getMimeType
Gets the mime type to serialize to.- Returns:
- the mime type for the current operation
-
getOutputStream
Gets the output stream for the current operation.This is the stream that was passed to
Gdk.contentSerializeAsync(org.gnome.gio.OutputStream, java.lang.String, org.gnome.gobject.Value, int, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)
.- Returns:
- the output stream for the current operation
-
getPriority
public int getPriority()Gets the I/O priority for the current operation.This is the priority that was passed to
Gdk.contentSerializeAsync(org.gnome.gio.OutputStream, java.lang.String, org.gnome.gobject.Value, int, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)
.- Returns:
- the I/O priority for the current operation
-
getTaskData
Gets the data that was associated with the current operation.- Returns:
- the task data for this ContentSerializer
-
getUserData
Gets the user data that was passed when the serializer was registered.- Specified by:
getUserData
in interfaceAsyncResult
- Returns:
- the user data for this serializer
-
getValue
Gets theGValue
to read the object to serialize from.- Returns:
- the
GValue
for the current operation
-
returnError
Indicate that the serialization has ended with an error.This function consumes
error
.- Parameters:
error
- aGError
-
returnSuccess
public void returnSuccess()Indicate that the serialization has been successfully completed. -
setTaskData
Associate data with the current serialization operation.- Parameters:
data
- data to associate with this operation
-
builder
AContentSerializer.Builder
object constructs aContentSerializer
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withContentSerializer.Builder.build()
.
-