org.apache.cassandra.io.compress

## Class CompressionMetadata.Writer

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

All Implemented Interfaces:
  java.io.Closeable, java.io.DataInput, java.io.DataOutput, java.lang.AutoCloseable

Enclosing class:
  CompressionMetadata

    public static class CompressionMetadata.Writer
    extends java.io.RandomAccessFile

### Method Summary

Methods
`long` `chunkOffsetBy(int chunkIndex)` Get a chunk offset by it's index.
`void` `close()`
`void` `finalizeHeader(long dataLength, int chunks)`
`static CompressionMetadata.Writer` `open(java.lang.String path)`
`void` `resetAndTruncate(int chunkIndex)` Reset the writer so that the next chunk offset written will be the one of `chunkIndex`.
`void` `writeHeader(CompressionParameters parameters)`

### Methods inherited from class java.io.RandomAccessFile

`getChannel, getFD, getFilePointer, length, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seek, setLength, skipBytes, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF`

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

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

### Method Detail

#### open

    public static CompressionMetadata.Writer open(java.lang.String path)

#### writeHeader

    public void writeHeader(CompressionParameters parameters)

#### finalizeHeader

    public void finalizeHeader(long dataLength,
                      int chunks)

#### chunkOffsetBy

    public long chunkOffsetBy(int chunkIndex)

Get a chunk offset by it's index.

Parameters:
  `chunkIndex` - Index of the chunk.
Returns:
  offset of the chunk in the compressed file.

#### resetAndTruncate

    public void resetAndTruncate(int chunkIndex)

Reset the writer so that the next chunk offset written will be the one of `chunkIndex`.

#### close

    public void close()
               throws java.io.IOException

Specified by:
  `close` in interface `java.io.Closeable`
Specified by:
  `close` in interface `java.lang.AutoCloseable`
Overrides:
  `close` in class `java.io.RandomAccessFile`
Throws:
  `java.io.IOException`