Class LZ4FPreferences

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class LZ4FPreferences
    extends Struct
    implements NativeResource
    Makes it possible to supply advanced compression instructions to streaming interface. Structure must be first init to 0, using memset(), setting all parameters to default. All reserved fields must be set to zero.

    Member documentation

    • compressionLevel – 0: default (fast mode); values > CLEVEL_MAX count as CLEVEL_MAX; values > 0 trigger "fast acceleration"
    • autoFlush – 1: always flush, reduces usage of internal buffers
    • favorDecSpeed – 1: parser favors decompression speed vs compression ratio. Only works for high compression modes (≥ CLEVEL_OPT_MIN). Since version 1.8.2.
    • reserved[3] – must be zero for forward compatibility

    Layout

    
     struct LZ4F_preferences_t {
         LZ4F_frameInfo_t frameInfo;
         int compressionLevel;
         unsigned autoFlush;
         unsigned favorDecSpeed;
         unsigned reserved[3];
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • FRAMEINFO, COMPRESSIONLEVEL, AUTOFLUSH, FAVORDECSPEED, RESERVED

        The struct member offsets.
    • Constructor Detail

      • LZ4FPreferences

        public LZ4FPreferences​(java.nio.ByteBuffer container)
        Creates a LZ4FPreferences 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 Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • compressionLevel

        public int compressionLevel()
        Returns the value of the compressionLevel field.
      • autoFlush

        public boolean autoFlush()
        Returns the value of the autoFlush field.
      • favorDecSpeed

        public boolean favorDecSpeed()
        Returns the value of the favorDecSpeed field.
      • reserved

        public java.nio.IntBuffer reserved()
        Returns a IntBuffer view of the reserved field.
      • reserved

        public int reserved​(int index)
        Returns the value at the specified index of the reserved field.
      • frameInfo

        public LZ4FPreferences frameInfo​(java.util.function.Consumer<LZ4FFrameInfo> consumer)
        Passes the frameInfo field to the specified Consumer.
      • compressionLevel

        public LZ4FPreferences compressionLevel​(int value)
        Sets the specified value to the compressionLevel field.
      • autoFlush

        public LZ4FPreferences autoFlush​(boolean value)
        Sets the specified value to the autoFlush field.
      • favorDecSpeed

        public LZ4FPreferences favorDecSpeed​(boolean value)
        Sets the specified value to the favorDecSpeed field.
      • reserved

        public LZ4FPreferences reserved​(java.nio.IntBuffer value)
        Copies the specified IntBuffer to the reserved field.
      • reserved

        public LZ4FPreferences reserved​(int index,
                                        int value)
        Sets the specified value at the specified index of the reserved field.
      • set

        public LZ4FPreferences set​(LZ4FFrameInfo frameInfo,
                                   int compressionLevel,
                                   boolean autoFlush,
                                   boolean favorDecSpeed,
                                   java.nio.IntBuffer reserved)
        Initializes this struct with the specified values.
      • set

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

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

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

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

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

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

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

        public static LZ4FPreferences mallocStack()
        Returns a new LZ4FPreferences instance allocated on the thread-local MemoryStack.
      • callocStack

        public static LZ4FPreferences callocStack()
        Returns a new LZ4FPreferences instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static LZ4FPreferences mallocStack​(MemoryStack stack)
        Returns a new LZ4FPreferences instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

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

        public static int ncompressionLevel​(long struct)
        Unsafe version of compressionLevel().
      • nautoFlush

        public static int nautoFlush​(long struct)
        Unsafe version of autoFlush().
      • nfavorDecSpeed

        public static int nfavorDecSpeed​(long struct)
        Unsafe version of favorDecSpeed().
      • nreserved

        public static java.nio.IntBuffer nreserved​(long struct)
        Unsafe version of reserved().
      • nreserved

        public static int nreserved​(long struct,
                                    int index)
        Unsafe version of reserved.
      • nframeInfo

        public static void nframeInfo​(long struct,
                                      LZ4FFrameInfo value)
        Unsafe version of frameInfo.
      • ncompressionLevel

        public static void ncompressionLevel​(long struct,
                                             int value)
        Unsafe version of compressionLevel.
      • nautoFlush

        public static void nautoFlush​(long struct,
                                      int value)
        Unsafe version of autoFlush.
      • nfavorDecSpeed

        public static void nfavorDecSpeed​(long struct,
                                          int value)
        Unsafe version of favorDecSpeed.
      • nreserved

        public static void nreserved​(long struct,
                                     java.nio.IntBuffer value)
        Unsafe version of reserved.
      • nreserved

        public static void nreserved​(long struct,
                                     int index,
                                     int value)
        Unsafe version of reserved.