Class ContentDeserializer

All Implemented Interfaces:
AsyncResult, Proxy

@Generated("org.javagi.JavaGI") public class ContentDeserializer extends GObject implements AsyncResult

Deserializes content received via inter-application data transfers.

The GdkContentDeserializer transforms serialized content that is identified by a mime type into an object identified by a GType.

GTK provides serializers and deserializers for common data types such as text, colors, images or file lists. To register your own deserialization functions, use Gdk.contentRegisterDeserializer(String, Type, ContentDeserializeFunc).

Also see ContentSerializer.

  • Constructor Details

    • ContentDeserializer

      public ContentDeserializer(MemorySegment address)
      Create a ContentDeserializer instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • ContentDeserializer

      public ContentDeserializer()
      Create a new ContentDeserializer.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the ContentDeserializer class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected ContentDeserializer asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • getCancellable

      public @Nullable Cancellable getCancellable()

      Gets the cancellable for the current operation.

      This is the GCancellable that was passed to Gdk.contentDeserializeAsync(InputStream, String, Type, int, Cancellable, AsyncReadyCallback).

      Returns:
      the cancellable for the current operation
    • getGtype

      public Type getGtype()
      Gets the GType to create an instance of.
      Returns:
      the GType for the current operation
    • getInputStream

      public InputStream getInputStream()

      Gets the input stream for the current operation.

      This is the stream that was passed to Gdk.contentDeserializeAsync(InputStream, String, Type, int, Cancellable, AsyncReadyCallback).

      Returns:
      the input stream for the current operation
    • getMimeType

      public String getMimeType()
      Gets the mime type to deserialize from.
      Returns:
      the mime type 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.contentDeserializeAsync(InputStream, String, Type, int, Cancellable, AsyncReadyCallback).

      Returns:
      the I/O priority for the current operation
    • getTaskData

      public @Nullable MemorySegment getTaskData()

      Gets the data that was associated with the current operation.

      See setTaskData(MemorySegment).

      Returns:
      the task data for this ContentDeserializer
    • getUserData

      public @Nullable MemorySegment getUserData()
      Gets the user data that was passed when the deserializer was registered.
      Specified by:
      getUserData in interface AsyncResult
      Returns:
      the user data for this deserializer
    • getValue

      public Value getValue()
      Gets the GValue to store the deserialized object in.
      Returns:
      the GValue for the current operation
    • returnError

      public void returnError(GError error)

      Indicate that the deserialization has ended with an error.

      This function consumes error.

      Parameters:
      error - a GError
    • returnSuccess

      public void returnSuccess()
      Indicate that the deserialization has been successfully completed.
    • setTaskData

      public void setTaskData(@Nullable MemorySegment data)
      Associate data with the current deserialization operation.
      Parameters:
      data - data to associate with this operation
    • builder

      public static ContentDeserializer.Builder<? extends ContentDeserializer.Builder> builder()
      A ContentDeserializer.Builder object constructs a ContentDeserializer with the specified properties. Use the various set...() methods to set properties, and finish construction with ContentDeserializer.Builder.build().
      Returns:
      the builder object