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

      public class CompressedSequentialWriter
      extends SequentialWriter

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `CompressedSequentialWriter.CompressedFileWriterMark` Class to hold a mark to the position of the file

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

      `SequentialWriter.BufferedFileWriterMark`

  - ### Field Summary

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

      `buffer, bufferOffset, current, isDirty, lastFlushOffset, out, stream, syncNeeded, validBufferBytes`

  - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `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()` Return the current file pointer of the underlying on-disk file.
    `FileMark` | `mark()`
    `CompressionMetadata` | `openAfterClose()`
    `CompressionMetadata` | `openEarly()`
    `void` | `resetAndTruncate(FileMark mark)`
    `void` | `sync()` Synchronize file contents with disk.
    `void` | `writeFullChecksum(Descriptor descriptor)`

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

      `flushInternal, getFilePointer, getLastFlushOffset, getPath, isOpen, length, open, open, open, open, reBuffer, resetBuffer, 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`
      Return 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`

    - #### sync

          public void sync()

      Description copied from class: `SequentialWriter`
      Synchronize file contents with disk.
      Overrides:
        `sync` in class `SequentialWriter`

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

    - #### openEarly

          public CompressionMetadata openEarly()

    - #### openAfterClose

          public CompressionMetadata openAfterClose()

    - #### mark

          public FileMark mark()

      Overrides:
        `mark` in class `SequentialWriter`

    - #### resetAndTruncate

          public void resetAndTruncate(FileMark mark)

      Overrides:
        `resetAndTruncate` in class `SequentialWriter`

    - #### close

          public void close()

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Specified by:
        `close` in interface `java.nio.channels.Channel`
      Overrides:
        `close` in class `SequentialWriter`

    - #### writeFullChecksum

          public void writeFullChecksum(Descriptor descriptor)

      Overrides:
        `writeFullChecksum` in class `SequentialWriter`

Copyright © 2014 The Apache Software Foundation