Package com.kenai.jffi
Class HeapInvocationBuffer.Encoder
- java.lang.Object
-
- com.kenai.jffi.HeapInvocationBuffer.Encoder
-
- Direct Known Subclasses:
HeapInvocationBuffer.DefaultEncoder
- Enclosing class:
- HeapInvocationBuffer
abstract static class HeapInvocationBuffer.Encoder extends java.lang.Object
Encodes java data types into native parameter frames
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
HeapInvocationBuffer.Encoder.SingletonHolder
-
Constructor Summary
Constructors Constructor Description Encoder()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
getBufferSize(CallContext callContext)
Gets the size in bytes of the buffer required for the function(package private) static HeapInvocationBuffer.Encoder
getInstance()
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)
-
-
-
Method Detail
-
getInstance
static HeapInvocationBuffer.Encoder getInstance()
-
getBufferSize
public abstract int getBufferSize(CallContext callContext)
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)
-
-