Class ByteArrayInterface

java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.gst.ByteArrayInterface
All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class ByteArrayInterface extends ProxyInstance

Interface for an array of bytes. It is expected to be subclassed to implement resize virtual method using language native array implementation, such as GLib's GByteArray, C++'s std::vector<uint8_t> or Rust's Vec<u8>.

resize implementation could allocate more than requested to avoid repeated reallocations. It can return false, or be set to null, in the case the array cannot grow.

Since:
1.24
  • Constructor Details

    • ByteArrayInterface

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

      public ByteArrayInterface(Arena arena)
      Allocate a new ByteArrayInterface.
      Parameters:
      arena - to control the memory allocation scope
    • ByteArrayInterface

      public ByteArrayInterface()
      Allocate a new ByteArrayInterface. The memory is allocated with Arena.ofAuto().
    • ByteArrayInterface

      public ByteArrayInterface(MemorySegment data, long len, ByteArrayInterface.ResizeCallback resize, Arena arena)
      Allocate a new ByteArrayInterface with the fields set to the provided values.
      Parameters:
      data - value for the field data
      len - value for the field len
      resize - callback function for the field resize
      arena - to control the memory allocation scope
    • ByteArrayInterface

      public ByteArrayInterface(MemorySegment data, long len, ByteArrayInterface.ResizeCallback resize)
      Allocate a new ByteArrayInterface with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      data - value for the field data
      len - value for the field len
      resize - callback function for the field resize
  • Method Details

    • getMemoryLayout

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

      public MemorySegment readData()
      Read the value of the field data.
      Returns:
      The value of the field data
    • writeData

      public void writeData(MemorySegment data)
      Write a value in the field data.
      Parameters:
      data - The new value for the field data
    • readLen

      public long readLen()
      Read the value of the field len.
      Returns:
      The value of the field len
    • writeLen

      public void writeLen(long len)
      Write a value in the field len.
      Parameters:
      len - The new value for the field len
    • overrideResize

      public void overrideResize(ByteArrayInterface.ResizeCallback resize, Arena _arena)
      Write a value in the field resize.
      Parameters:
      resize - The new value for the field resize
      _arena - to control the memory allocation scope