Package com.kenai.jffi
Class HeapInvocationBuffer.Encoder
java.lang.Object
com.kenai.jffi.HeapInvocationBuffer.Encoder
- Direct Known Subclasses:
HeapInvocationBuffer.DefaultEncoder
- Enclosing class:
HeapInvocationBuffer
Encodes java data types into native parameter frames
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract int
getBufferSize
(CallContext callContext) Gets the size in bytes of the buffer required for the function(package private) static HeapInvocationBuffer.Encoder
abstract int
putAddress
(byte[] buffer, int offset, long value) Encodes a native memory address value into the byte array.abstract int
putByte
(byte[] buffer, int offset, int value) Encodes a byte value into the byte array.abstract int
putDouble
(byte[] buffer, int offset, double value) Encodes a double value into the byte array.abstract int
putFloat
(byte[] buffer, int offset, float value) Encodes a float value into the byte array.abstract int
putInt
(byte[] buffer, int offset, int value) Encodes an int value into the byte array.abstract int
putLong
(byte[] buffer, int offset, long value) Encodes a long value into the byte array.abstract int
putShort
(byte[] buffer, int offset, int value) Encodes a short value into the byte array.abstract int
skipAddress
(int offset)
-
Constructor Details
-
Encoder
Encoder()
-
-
Method Details
-
getInstance
-
getBufferSize
Gets the size in bytes of the buffer required for the function -
putByte
public abstract int putByte(byte[] buffer, int offset, int value) Encodes a byte value into the byte array.- Parameters:
buffer
- The destination byte buffer to place the encoded value.offset
- The offset within the destination buffer to place the value.value
- The value to encode.- Returns:
- The number of bytes consumed in encoding the value.
-
putShort
public abstract int putShort(byte[] buffer, int offset, int value) Encodes a short value into the byte array.- Parameters:
buffer
- The destination byte buffer to place the encoded value.offset
- The offset within the destination buffer to place the value.value
- The value to encode.- Returns:
- The number of bytes consumed in encoding the value.
-
putInt
public abstract int putInt(byte[] buffer, int offset, int value) Encodes an int value into the byte array.- Parameters:
buffer
- The destination byte buffer to place the encoded value.offset
- The offset within the destination buffer to place the value.value
- The value to encode.- Returns:
- The number of bytes consumed in encoding the value.
-
putLong
public abstract int putLong(byte[] buffer, int offset, long value) Encodes a long value into the byte array.- Parameters:
buffer
- The destination byte buffer to place the encoded value.offset
- The offset within the destination buffer to place the value.value
- The value to encode.- Returns:
- The number of bytes consumed in encoding the value.
-
putFloat
public abstract int putFloat(byte[] buffer, int offset, float value) Encodes a float value into the byte array.- Parameters:
buffer
- The destination byte buffer to place the encoded value.offset
- The offset within the destination buffer to place the value.value
- The value to encode.- Returns:
- The number of bytes consumed in encoding the value.
-
putDouble
public abstract int putDouble(byte[] buffer, int offset, double value) Encodes a double value into the byte array.- Parameters:
buffer
- The destination byte buffer to place the encoded value.offset
- The offset within the destination buffer to place the value.value
- The value to encode.- Returns:
- The number of bytes consumed in encoding the value.
-
putAddress
public abstract int putAddress(byte[] buffer, int offset, long value) Encodes a native memory address value into the byte array.- Parameters:
buffer
- The destination byte buffer to place the encoded value.offset
- The offset within the destination buffer to place the value.value
- The value to encode.- Returns:
- The number of bytes consumed in encoding the value.
-
skipAddress
public abstract int skipAddress(int offset)
-