org.apache.cassandra.io.compress

## Class CompressedSequentialWriter

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

All Implemented Interfaces:
  java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable, java.nio.channels.Channel, java.nio.channels.WritableByteChannel, 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

`buffer, bufferOffset, channel, descriptor, isDirty, lastFlushOffset, runPostFlush, stream, syncNeeded`

### Constructor Summary

Constructors
Constructor and Description
`CompressedSequentialWriter(java.io.File file, java.lang.String offsetsPath, CompressionParameters parameters, MetadataCollector sstableMetadataCollector)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `flush()` If buffer is dirty, flush it's contents to the operating system.
`protected void` `flushData()` Override this method instead of overriding flush()
`long` `getOnDiskFilePointer()` Returns the current file pointer of the underlying on-disk file.
`FileMark` `mark()`
`CompressionMetadata` `open(long overrideLength)`
`void` `resetAndTruncate(FileMark 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, finish, finishOnClose, flushInternal, getFilePointer, getLastFlushOffset, getPath, isOpen, length, open, open, open, prepareToCommit, reBuffer, releaseFileHandle, resetBuffer, setDescriptor, setPostFlushListener, sync, syncDataOnlyInternal, syncInternal, truncate, write, write, write, write`

### 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,
                                      CompressionParameters parameters,
                                      MetadataCollector sstableMetadataCollector)

### 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

#### flush

    public void flush()

Description copied from class: `SequentialWriter`
If buffer is dirty, flush it's contents to the operating system. Does not imply fsync(). Currently, for implementation reasons, this also invalidates the buffer.

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

#### 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 FileMark mark()

Overrides:
  `mark` in class `SequentialWriter`

#### resetAndTruncate

    public void resetAndTruncate(FileMark 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`