Package org.freedesktop.gstreamer.gst
Class ByteArrayInterface
java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.gst.ByteArrayInterface
- All Implemented Interfaces:
Proxy
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theResizeCallbackcallback. -
Constructor Summary
ConstructorsConstructorDescriptionAllocate a new ByteArrayInterface.ByteArrayInterface(Arena arena) Allocate a new ByteArrayInterface.ByteArrayInterface(MemorySegment address) Create a ByteArrayInterface proxy instance for the provided memory address.ByteArrayInterface(MemorySegment data, long len, ByteArrayInterface.ResizeCallback resize) Allocate a new ByteArrayInterface with the fields set to the provided values.ByteArrayInterface(MemorySegment data, long len, ByteArrayInterface.ResizeCallback resize, Arena arena) Allocate a new ByteArrayInterface with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionstatic MemoryLayoutThe memory layout of the native struct.voidoverrideResize(ByteArrayInterface.ResizeCallback resize, Arena _arena) Write a value in the fieldresize.readData()Read the value of the fielddata.longreadLen()Read the value of the fieldlen.voidwriteData(MemorySegment data) Write a value in the fielddata.voidwriteLen(long len) Write a value in the fieldlen.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
ByteArrayInterface
Create a ByteArrayInterface proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
ByteArrayInterface
Allocate a new ByteArrayInterface.- Parameters:
arena- to control the memory allocation scope
-
ByteArrayInterface
public ByteArrayInterface()Allocate a new ByteArrayInterface. The memory is allocated withArena.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 fielddatalen- value for the fieldlenresize- callback function for the fieldresizearena- to control the memory allocation scope
-
ByteArrayInterface
Allocate a new ByteArrayInterface with the fields set to the provided values. The memory is allocated withArena.ofAuto().- Parameters:
data- value for the fielddatalen- value for the fieldlenresize- callback function for the fieldresize
-
-
Method Details
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readData
Read the value of the fielddata.- Returns:
- The value of the field
data
-
writeData
Write a value in the fielddata.- Parameters:
data- The new value for the fielddata
-
readLen
public long readLen()Read the value of the fieldlen.- Returns:
- The value of the field
len
-
writeLen
public void writeLen(long len) Write a value in the fieldlen.- Parameters:
len- The new value for the fieldlen
-
overrideResize
Write a value in the fieldresize.- Parameters:
resize- The new value for the fieldresize_arena- to control the memory allocation scope
-