CompressionMetadata (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.io.compress

## Class CompressionMetadata

- java.lang.Object
- - org.apache.cassandra.io.compress.CompressionMetadata

-     public class CompressionMetadata
      extends java.lang.Object

  Holds metadata about compressed file

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CompressionMetadata.Chunk` Holds offset and length of the file chunk
    `static class` | `CompressionMetadata.Writer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `long` | `compressedFileLength`
    `long` | `dataLength`
    `boolean` | `hasPostCompressionAdlerChecksums`
    `java.lang.String` | `indexFilePath`
    `CompressionParameters` | `parameters`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `CompressionMetadata.Chunk` | `chunkFor(long position)` Get a chunk of compressed data (offset, length) corresponding to given position
    `int` | `chunkLength()`
    `void` | `close()`
    `ICompressor` | `compressor()`
    `static CompressionMetadata` | `create(java.lang.String dataFilePath)` Create metadata about given compressed file including uncompressed data length, chunk size and list of the chunk offsets of the compressed data.
    `CompressionMetadata.Chunk[]` | `getChunksForSections(java.util.Collection<Pair<java.lang.Long,java.lang.Long>> sections)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### dataLength

          public final long dataLength

    - #### compressedFileLength

          public final long compressedFileLength

    - #### hasPostCompressionAdlerChecksums

          public final boolean hasPostCompressionAdlerChecksums

    - #### indexFilePath

          public final java.lang.String indexFilePath

    - #### parameters

          public final CompressionParameters parameters

  - ### Method Detail

    - #### create

          public static CompressionMetadata create(java.lang.String dataFilePath)

      Create metadata about given compressed file including uncompressed data length, chunk size and list of the chunk offsets of the compressed data. This is an expensive operation! Don't create more than one for each sstable.
      Parameters:
        `dataFilePath` - Path to the compressed file
      Returns:
        metadata about given compressed file.

    - #### compressor

          public ICompressor compressor()

    - #### chunkLength

          public int chunkLength()

    - #### chunkFor

          public CompressionMetadata.Chunk chunkFor(long position)

      Get a chunk of compressed data (offset, length) corresponding to given position
      Parameters:
        `position` - Position in the file.
      Returns:
        pair of chunk offset and length.

    - #### getChunksForSections

          public CompressionMetadata.Chunk[] getChunksForSections(java.util.Collection<Pair<java.lang.Long,java.lang.Long>> sections)

      Parameters:
        `sections` - Collection of sections in uncompressed file
      Returns:
        Array of chunks which corresponds to given sections of uncompressed file, sorted by chunk offset

    - #### close

          public void close()

Copyright © 2014 The Apache Software Foundation