Class LZ4FCustomMem

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class LZ4FCustomMem extends Struct<LZ4FCustomMem> implements NativeResource

 struct LZ4F_CustomMem {
     {@link LZ4FAllocFunctionI LZ4F_AllocFunction} customAlloc;
     {@link LZ4FCallocFunctionI LZ4F_CallocFunction} customCalloc;
     {@link LZ4FFreeFunctionI LZ4F_FreeFunction} customFree;
     void * opaqueState;
 }
  • Field Details

    • SIZEOF

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

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

      public static final int CUSTOMALLOC
      The struct member offsets.
    • CUSTOMCALLOC

      public static final int CUSTOMCALLOC
      The struct member offsets.
    • CUSTOMFREE

      public static final int CUSTOMFREE
      The struct member offsets.
    • OPAQUESTATE

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

    • LZ4FCustomMem

      public LZ4FCustomMem(ByteBuffer container)
      Creates a LZ4FCustomMem 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<LZ4FCustomMem>
    • customAlloc

      public LZ4FAllocFunction customAlloc()
      Returns:
      the value of the customAlloc field.
    • customCalloc

      public @Nullable LZ4FCallocFunction customCalloc()
      Returns:
      the value of the customCalloc field.
    • customFree

      public LZ4FFreeFunction customFree()
      Returns:
      the value of the customFree field.
    • opaqueState

      public long opaqueState()
      Returns:
      the value of the opaqueState field.
    • customAlloc

      public LZ4FCustomMem customAlloc(LZ4FAllocFunctionI value)
      Sets the specified value to the customAlloc field.
    • customCalloc

      public LZ4FCustomMem customCalloc(@Nullable LZ4FCallocFunctionI value)
      Sets the specified value to the customCalloc field.
    • customFree

      public LZ4FCustomMem customFree(LZ4FFreeFunctionI value)
      Sets the specified value to the customFree field.
    • opaqueState

      public LZ4FCustomMem opaqueState(long value)
      Sets the specified value to the opaqueState field.
    • set

      public LZ4FCustomMem set(LZ4FAllocFunctionI customAlloc, LZ4FCallocFunctionI customCalloc, LZ4FFreeFunctionI customFree, long opaqueState)
      Initializes this struct with the specified values.
    • set

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static LZ4FCustomMem.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new LZ4FCustomMem.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
    • ncustomAlloc

      public static LZ4FAllocFunction ncustomAlloc(long struct)
      Unsafe version of customAlloc().
    • ncustomCalloc

      public static @Nullable LZ4FCallocFunction ncustomCalloc(long struct)
      Unsafe version of customCalloc().
    • ncustomFree

      public static LZ4FFreeFunction ncustomFree(long struct)
      Unsafe version of customFree().
    • nopaqueState

      public static long nopaqueState(long struct)
      Unsafe version of opaqueState().
    • ncustomAlloc

      public static void ncustomAlloc(long struct, LZ4FAllocFunctionI value)
      Unsafe version of customAlloc.
    • ncustomCalloc

      public static void ncustomCalloc(long struct, @Nullable LZ4FCallocFunctionI value)
      Unsafe version of customCalloc.
    • ncustomFree

      public static void ncustomFree(long struct, LZ4FFreeFunctionI value)
      Unsafe version of customFree.
    • nopaqueState

      public static void nopaqueState(long struct, long value)
      Unsafe version of opaqueState.
    • validate

      public static void validate(long struct)
      Validates pointer members that should not be NULL.
      Parameters:
      struct - the struct to validate