Class ContentSerializer
- All Implemented Interfaces:
AsyncResult,Proxy
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
Nested ClassesModifier and TypeClassDescriptionstatic classContentSerializer.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.ObjectClassNested classes/interfaces inherited from interface org.gnome.gio.AsyncResult
AsyncResult.AsyncResult$Impl, AsyncResult.AsyncResultIface -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new ContentSerializer.ContentSerializer(MemorySegment address) Create a ContentSerializer proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ContentSerializerasParent()Returns this instance as if it were its parent type.static ContentSerializer.Builder<? extends ContentSerializer.Builder> builder()AContentSerializer.Builderobject constructs aContentSerializerwith the specified properties.@Nullable CancellableGets the cancellable for the current operation.getGtype()Gets theGTypeto of the object to serialize.Gets the mime type to serialize to.Gets the output stream for the current operation.intGets the I/O priority for the current operation.@Nullable MemorySegmentGets the data that was associated with the current operation.static @Nullable TypegetType()Get the GType of the ContentSerializer class@Nullable MemorySegmentGets the user data that was passed when the serializer was registered.getValue()Gets theGValueto read the object to serialize from.voidreturnError(GError error) Indicate that the serialization has ended with an error.voidIndicate that the serialization has been successfully completed.voidsetTaskData(@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, 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, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods 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
-
ContentSerializer
public ContentSerializer()Creates a new ContentSerializer.
-
-
Method Details
-
getType
Get the GType of the ContentSerializer class- Returns:
- the GType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, 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
GCancellablethat 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 theGTypeto of the object to serialize.- Returns:
- the
GTypefor 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:
getUserDatain interfaceAsyncResult- Returns:
- the user data for this serializer
-
getValue
Gets theGValueto read the object to serialize from.- Returns:
- the
GValuefor 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.Builderobject constructs aContentSerializerwith the specified properties. Use the variousset...()methods to set properties, and finish construction withContentSerializer.Builder.build().- Returns:
- the builder object
-