org.apache.cassandra.io.compress

## Class CompressedSequentialWriter

- java.lang.Object
- - java.io.OutputStream
  - - org.apache.cassandra.io.util.DataOutputStreamPlus
    - - org.apache.cassandra.io.util.BufferedDataOutputStreamPlus
      - - org.apache.cassandra.io.util.SequentialWriter
        - - org.apache.cassandra.io.compress.CompressedSequentialWriter

All Implemented Interfaces:
  java.io.Closeable, java.io.DataOutput, java.io.Flushable, java.lang.AutoCloseable, DataOutputPlus, Transactional

    public class CompressedSequentialWriter
    extends SequentialWriter

### Nested Class Summary

Nested Classes
`protected static class` `CompressedSequentialWriter.CompressedFileWriterMark` Class to hold a mark to the position of the file
`protected class` `CompressedSequentialWriter.TransactionalProxy`

### Nested classes/interfaces inherited from class org.apache.cassandra.io.util.SequentialWriter

`SequentialWriter.BufferedFileWriterMark`

### Nested classes/interfaces inherited from interface org.apache.cassandra.utils.concurrent.Transactional

`Transactional.AbstractTransactional`

### Field Summary

### Fields inherited from class org.apache.cassandra.io.util.SequentialWriter

`bufferOffset, fchannel, lastFlushOffset, runPostFlush`

### Fields inherited from class org.apache.cassandra.io.util.BufferedDataOutputStreamPlus

`buffer, strictFlushing`

### Fields inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus

`channel`

### Constructor Summary

Constructors
Constructor and Description
`CompressedSequentialWriter(java.io.File file, java.lang.String offsetsPath, java.io.File digestFile, SequentialWriterOption option, CompressionParams parameters, MetadataCollector sstableMetadataCollector)` Create CompressedSequentialWriter without digest file.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `flush()`
`protected void` `flushData()` Override this method instead of overriding flush()
`long` `getEstimatedOnDiskBytesWritten()` Get a quick estimation on how many bytes have been written to disk It should for the most part be exactly the same as getOnDiskFilePointer()
`long` `getOnDiskFilePointer()` Returns the current file pointer of the underlying on-disk file.
`DataPosition` `mark()`
`CompressionMetadata` `open(long overrideLength)`
`void` `resetAndTruncate(DataPosition mark)` Drops all buffered data that's past the limits of our new file mark + buffer capacity, or syncs and truncates the underlying file to the marked position
`protected SequentialWriter.TransactionalProxy` `txnProxy()`

### Methods inherited from class org.apache.cassandra.io.util.SequentialWriter

`abort, close, commit, current, doFlush, finish, getLastFlushOffset, getPath, hasPosition, isOpen, length, position, prepareToCommit, resetBuffer, setPostFlushListener, skipBytes, sync, syncDataOnlyInternal, syncInternal, truncate`

### Methods inherited from class org.apache.cassandra.io.util.BufferedDataOutputStreamPlus

`applyToChannel, order, write, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUnsignedVInt, writeUTF, writeVInt`

### Methods inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus

`newDefaultChannel, retrieveTemporaryBuffer`

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

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

### Constructor Detail

#### CompressedSequentialWriter

    public CompressedSequentialWriter(java.io.File file,
                                      java.lang.String offsetsPath,
                                      java.io.File digestFile,
                                      SequentialWriterOption option,
                                      CompressionParams parameters,
                                      MetadataCollector sstableMetadataCollector)

Create CompressedSequentialWriter without digest file.

Parameters:
  `file` - File to write
  `offsetsPath` - File name to write compression metadata
  `digestFile` - File to write digest
  `option` - Write option (buffer size and type will be set the same as compression params)
  `parameters` - Compression mparameters
  `sstableMetadataCollector` - Metadata collector

### Method Detail

#### getOnDiskFilePointer

    public long getOnDiskFilePointer()

Description copied from class: `SequentialWriter`
Returns the current file pointer of the underlying on-disk file. Note that since write works by buffering data, the value of this will increase by buffer size and not every write to the writer will modify this value. Furthermore, for compressed files, this value refers to compressed data, while the writer getFilePointer() refers to uncompressedFile

Overrides:
  `getOnDiskFilePointer` in class `SequentialWriter`
Returns:
  the current file pointer

#### getEstimatedOnDiskBytesWritten

    public long getEstimatedOnDiskBytesWritten()

Get a quick estimation on how many bytes have been written to disk It should for the most part be exactly the same as getOnDiskFilePointer()

Overrides:
  `getEstimatedOnDiskBytesWritten` in class `SequentialWriter`

#### flush

    public void flush()

Specified by:
  `flush` in interface `java.io.Flushable`
Overrides:
  `flush` in class `BufferedDataOutputStreamPlus`

#### flushData

    protected void flushData()

Description copied from class: `SequentialWriter`
Override this method instead of overriding flush()

Overrides:
  `flushData` in class `SequentialWriter`

#### open

    public CompressionMetadata open(long overrideLength)

#### mark

    public DataPosition mark()

Overrides:
  `mark` in class `SequentialWriter`

#### resetAndTruncate

    public void resetAndTruncate(DataPosition mark)

Description copied from class: `SequentialWriter`
Drops all buffered data that's past the limits of our new file mark + buffer capacity, or syncs and truncates the underlying file to the marked position

Overrides:
  `resetAndTruncate` in class `SequentialWriter`

#### txnProxy

    protected SequentialWriter.TransactionalProxy txnProxy()

Overrides:
  `txnProxy` in class `SequentialWriter`