Class IOVec

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class IOVec extends Struct<IOVec> implements NativeResource

 struct iovec {
     void * iov_base;
     size_t iov_len;
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • IOV_BASE

      public static final int IOV_BASE
      The struct member offsets.
    • IOV_LEN

      public static final int IOV_LEN
      The struct member offsets.
  • Constructor Details

    • IOVec

      public IOVec(ByteBuffer container)
      Creates a IOVec instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<IOVec>
    • iov_base

      public @Nullable ByteBuffer iov_base()
      Returns:
      a ByteBuffer view of the data pointed to by the iov_base field.
    • iov_len

      public long iov_len()
      Returns:
      the value of the iov_len field.
    • iov_base

      public IOVec iov_base(@Nullable ByteBuffer value)
      Sets the address of the specified ByteBuffer to the iov_base field.
    • iov_len

      public IOVec iov_len(long value)
      Sets the specified value to the iov_len field.
    • set

      public IOVec set(@Nullable ByteBuffer iov_base, long iov_len)
      Initializes this struct with the specified values.
    • set

      public IOVec set(IOVec src)
      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static IOVec malloc()
      Returns a new IOVec instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static IOVec calloc()
      Returns a new IOVec instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static IOVec create()
      Returns a new IOVec instance allocated with BufferUtils.
    • create

      public static IOVec create(long address)
      Returns a new IOVec instance for the specified memory address.
    • createSafe

      public static @Nullable IOVec createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static IOVec.Buffer malloc(int capacity)
      Returns a new IOVec.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static IOVec.Buffer calloc(int capacity)
      Returns a new IOVec.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static IOVec.Buffer create(int capacity)
      Returns a new IOVec.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static IOVec.Buffer create(long address, int capacity)
      Create a IOVec.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable IOVec.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • malloc

      public static IOVec malloc(MemoryStack stack)
      Returns a new IOVec instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static IOVec calloc(MemoryStack stack)
      Returns a new IOVec instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static IOVec.Buffer malloc(int capacity, MemoryStack stack)
      Returns a new IOVec.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static IOVec.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new IOVec.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • niov_base

      public static @Nullable ByteBuffer niov_base(long struct)
      Unsafe version of iov_base.
    • niov_len

      public static long niov_len(long struct)
      Unsafe version of iov_len().
    • niov_base

      public static void niov_base(long struct, @Nullable ByteBuffer value)
      Unsafe version of iov_base.
    • niov_len

      public static void niov_len(long struct, long value)
      Unsafe version of iov_len.