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
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final int
    Gets the size in bytes of the buffer required for the function
    final int
    putAddress(byte[] buffer, int offset, long value)
    Encodes a native memory address value into the byte array.
    final int
    putByte(byte[] buffer, int offset, int value)
    Encodes a byte value into the byte array.
    final int
    putDouble(byte[] buffer, int offset, double value)
    Encodes a double value into the byte array.
    final int
    putFloat(byte[] buffer, int offset, float value)
    Encodes a float value into the byte array.
    final int
    putInt(byte[] buffer, int offset, int value)
    Encodes an int value into the byte array.
    final int
    putLong(byte[] buffer, int offset, long value)
    Encodes a long value into the byte array.
    final int
    putShort(byte[] buffer, int offset, int value)
    Encodes a short value into the byte array.
    int
    skipAddress(int offset)
     

    Methods inherited from class com.kenai.jffi.HeapInvocationBuffer.Encoder

    getInstance

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • getBufferSize

      public final int getBufferSize(CallContext callContext)
      Description copied from class: HeapInvocationBuffer.Encoder
      Gets the size in bytes of the buffer required for the function
      Specified by:
      getBufferSize in class HeapInvocationBuffer.Encoder
    • putByte

      public final int putByte(byte[] buffer, int offset, int value)
      Description copied from class: HeapInvocationBuffer.Encoder
      Encodes a byte value into the byte array.
      Specified by:
      putByte in class HeapInvocationBuffer.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.Encoder
      Encodes a short value into the byte array.
      Specified by:
      putShort in class HeapInvocationBuffer.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.Encoder
      Encodes an int value into the byte array.
      Specified by:
      putInt in class HeapInvocationBuffer.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.Encoder
      Encodes a long value into the byte array.
      Specified by:
      putLong in class HeapInvocationBuffer.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.Encoder
      Encodes a float value into the byte array.
      Specified by:
      putFloat in class HeapInvocationBuffer.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.Encoder
      Encodes a double value into the byte array.
      Specified by:
      putDouble in class HeapInvocationBuffer.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.Encoder
      Encodes a native memory address value into the byte array.
      Specified by:
      putAddress in class HeapInvocationBuffer.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:
      skipAddress in class HeapInvocationBuffer.Encoder