Package com.kenai.jffi
Class HeapInvocationBuffer.DefaultEncoder
- java.lang.Object
-
- com.kenai.jffi.HeapInvocationBuffer.Encoder
-
- com.kenai.jffi.HeapInvocationBuffer.DefaultEncoder
-
- Enclosing class:
- HeapInvocationBuffer
private static final class HeapInvocationBuffer.DefaultEncoder extends HeapInvocationBuffer.Encoder
-
-
Field Summary
Fields Modifier and Type Field Description private HeapInvocationBuffer.ArrayIOio
-
Constructor Summary
Constructors Constructor Description DefaultEncoder(HeapInvocationBuffer.ArrayIO io)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetBufferSize(CallContext callContext)Gets the size in bytes of the buffer required for the functionintputAddress(byte[] buffer, int offset, long value)Encodes a native memory address value into the byte array.intputByte(byte[] buffer, int offset, int value)Encodes a byte value into the byte array.intputDouble(byte[] buffer, int offset, double value)Encodes a double value into the byte array.intputFloat(byte[] buffer, int offset, float value)Encodes a float value into the byte array.intputInt(byte[] buffer, int offset, int value)Encodes an int value into the byte array.intputLong(byte[] buffer, int offset, long value)Encodes a long value into the byte array.intputShort(byte[] buffer, int offset, int value)Encodes a short value into the byte array.intskipAddress(int offset)-
Methods inherited from class com.kenai.jffi.HeapInvocationBuffer.Encoder
getInstance
-
-
-
-
Field Detail
-
io
private final HeapInvocationBuffer.ArrayIO io
-
-
Constructor Detail
-
DefaultEncoder
public DefaultEncoder(HeapInvocationBuffer.ArrayIO io)
-
-
Method Detail
-
getBufferSize
public final int getBufferSize(CallContext callContext)
Description copied from class:HeapInvocationBuffer.EncoderGets the size in bytes of the buffer required for the function- Specified by:
getBufferSizein classHeapInvocationBuffer.Encoder
-
putByte
public final int putByte(byte[] buffer, int offset, int value)Description copied from class:HeapInvocationBuffer.EncoderEncodes a byte value into the byte array.- Specified by:
putBytein classHeapInvocationBuffer.Encoder- 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 final int putShort(byte[] buffer, int offset, int value)Description copied from class:HeapInvocationBuffer.EncoderEncodes a short value into the byte array.- Specified by:
putShortin classHeapInvocationBuffer.Encoder- 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 final int putInt(byte[] buffer, int offset, int value)Description copied from class:HeapInvocationBuffer.EncoderEncodes an int value into the byte array.- Specified by:
putIntin classHeapInvocationBuffer.Encoder- 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 final int putLong(byte[] buffer, int offset, long value)Description copied from class:HeapInvocationBuffer.EncoderEncodes a long value into the byte array.- Specified by:
putLongin classHeapInvocationBuffer.Encoder- 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 final int putFloat(byte[] buffer, int offset, float value)Description copied from class:HeapInvocationBuffer.EncoderEncodes a float value into the byte array.- Specified by:
putFloatin classHeapInvocationBuffer.Encoder- 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 final int putDouble(byte[] buffer, int offset, double value)Description copied from class:HeapInvocationBuffer.EncoderEncodes a double value into the byte array.- Specified by:
putDoublein classHeapInvocationBuffer.Encoder- 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 final int putAddress(byte[] buffer, int offset, long value)Description copied from class:HeapInvocationBuffer.EncoderEncodes a native memory address value into the byte array.- Specified by:
putAddressin classHeapInvocationBuffer.Encoder- 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 int skipAddress(int offset)
- Specified by:
skipAddressin classHeapInvocationBuffer.Encoder
-
-