Package org.freedesktop.gstreamer.gst
Class ByteArrayInterface
java.lang.Object
io.github.jwharm.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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Functional interface declaration of theResizeCallback
callback. -
Constructor Summary
ConstructorDescriptionAllocate 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 MemoryLayout
The memory layout of the native struct.void
overrideResize
(ByteArrayInterface.ResizeCallback resize, Arena _arena) Write a value in the fieldresize
.readData()
Read the value of the fielddata
.long
readLen()
Read the value of the fieldlen
.void
writeData
(MemorySegment data) Write a value in the fielddata
.void
writeLen
(long len) Write a value in the fieldlen
.Methods inherited from class io.github.jwharm.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 fielddata
len
- value for the fieldlen
resize
- callback function for the fieldresize
arena
- 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 fielddata
len
- value for the fieldlen
resize
- 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
-