Class ByteArray

All Implemented Interfaces:
Proxy

@NullMarked public class ByteArray extends ProxyInstance
This class is used for internal purposes by Java-GI. Java-GI automatically marshals GByteArray instances from and to java byte[] primitives.
  • Constructor Details

    • ByteArray

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

      public ByteArray()
      Creates a new GByteArray with a reference count of 1.
  • Method Details

    • getType

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

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

      public int readLen()
      Read the value of the field len.
      Returns:
      The value of the field len
    • take

      public static ByteArray take(byte @Nullable [] data)
      Creates a byte array containing the data.
      Parameters:
      data - byte data for the array
      Returns:
      a new GByteArray
    • takeUnowned

      public static ByteArray takeUnowned(byte @Nullable [] data)
      Creates a byte array containing the data. The allocated native memory is not freed automatically by Java-GI.
      Parameters:
      data - byte data for the array
      Returns:
      a new GByteArray