Package com.sleepycat.db

## Interface BtreeCompressor

-     public interface BtreeCompressor

  An interface specifying how Btree compression works.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `compress​(Database db, DatabaseEntry prevKey, DatabaseEntry prevData, DatabaseEntry key, DatabaseEntry data, DatabaseEntry dest)` | The application-specific Btree compress callback.
    `boolean` | `decompress​(Database db, DatabaseEntry prevKey, DatabaseEntry prevData, DatabaseEntry compressed, DatabaseEntry key, DatabaseEntry data)` | The application-specific Btree decompress callback.

- - ### Method Detail

    - #### compress

          boolean compress​(Database db,
                           DatabaseEntry prevKey,
                           DatabaseEntry prevData,
                           DatabaseEntry key,
                           DatabaseEntry data,
                           DatabaseEntry dest)

      The application-specific Btree compress callback.

      The compress function must return true on success and false on failure. If the compressed data is larger than dest.getUserBufferLength() the function should set the required length in the dest DatabaseEntry via setSize and return false.

      Parameters:
        `db` - The enclosing database handle.
        `prevKey` - A database entry representing the previous key from the compressed stream.
        `prevData` - A database entry representing the data matching prevKey key entry.
        `key` - A database entry representing representing the application supplied key.
        `data` - A database entry representing representing the application supplied data.
        `dest` - A database entry representing the data stored in the tree. This is where the callback function should write the compressed data.
      Returns:
        true on success and false on failure

    - #### decompress

          boolean decompress​(Database db,
                             DatabaseEntry prevKey,
                             DatabaseEntry prevData,
                             DatabaseEntry compressed,
                             DatabaseEntry key,
                             DatabaseEntry data)

      The application-specific Btree decompress callback.

      The decompress function must return true on success, and false on failure.

      Parameters:
        `db` - The enclosing database handle.
        `prevKey` - A database entry representing the previous key from the compressed stream.
        `prevData` - A database entry representing the data matching prevKey key entry.
        `compressed` - A database entry representing the data stored in the tree. That is the compressed data.
        `key` - A database entry representing representing the application supplied key.
        `data` - A database entry representing representing the application supplied data.
      Returns:
        true on success and false on failure

Copyright (c) 1996, 2020 Oracle and/or its affiliates. All rights reserved.