org.apache.cassandra.io.sstable

## Class SSTableWriter

- java.lang.Object
- - org.apache.cassandra.io.sstable.SSTable
  - - org.apache.cassandra.io.sstable.SSTableWriter

    public class SSTableWriter
    extends SSTable

### Field Summary

Fields
`static int` `END_OF_ROW`

### Fields inherited from class org.apache.cassandra.io.sstable.SSTable

`COMPONENT_DATA, COMPONENT_DIGEST, COMPONENT_FILTER, COMPONENT_INDEX, COMPONENT_STATS, components, compression, descriptor, first, last, maxTimestampComparator, metadata, partitioner, sstableComparator, sstableOrdering, TEMPFILE_MARKER, TOMBSTONE_HISTOGRAM_BIN_SIZE`

### Constructor Summary

Constructors
Constructor and Description
`SSTableWriter(java.lang.String filename, long keyCount)`
`SSTableWriter(java.lang.String filename, long keyCount, CFMetaData metadata, IPartitioner<?> partitioner, SSTableMetadata.Collector sstableMetadataCollector)`

### Method Summary

Methods
`void` `abort()` After failure, attempt to close the index writer and data file before deleting all temp components for the sstable
`RowIndexEntry` `append(AbstractCompactedRow row)`
`void` `append(DecoratedKey decoratedKey, ColumnFamily cf)`
`long` `appendFromStream(DecoratedKey key, CFMetaData metadata, java.io.DataInput in, Descriptor.Version version)`
`Pair<Descriptor,SSTableMetadata>` `close()`
`SSTableReader` `closeAndOpenReader()`
`SSTableReader` `closeAndOpenReader(long maxDataAge)`
`long` `getFilePointer()`
`long` `getOnDiskFilePointer()`
`void` `mark()`
`static RowIndexEntry` `rawAppend(ColumnFamily cf, long startPosition, DecoratedKey key, java.io.DataOutput out)`
`static void` `rename(Descriptor tmpdesc, Descriptor newdesc, java.util.Set<Component> components)`
`void` `resetAndTruncate()`

### Methods inherited from class org.apache.cassandra.io.sstable.SSTable

`addComponents, appendTOC, bytesOnDisk, componentsFor, delete, getColumnFamilyName, getFilename, getIndexFilename, getKeyspaceName, getMinimalKey, getTotalBytes, readTOC, toString, tryComponentFromFilename`

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

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

### Field Detail

#### END_OF_ROW

    public static final int END_OF_ROW

See Also:
  Constant Field Values

### Constructor Detail

#### SSTableWriter

    public SSTableWriter(java.lang.String filename,
                 long keyCount)

#### SSTableWriter

    public SSTableWriter(java.lang.String filename,
                 long keyCount,
                 CFMetaData metadata,
                 IPartitioner<?> partitioner,
                 SSTableMetadata.Collector sstableMetadataCollector)

### Method Detail

#### mark

    public void mark()

#### resetAndTruncate

    public void resetAndTruncate()

#### append

    public RowIndexEntry append(AbstractCompactedRow row)

Parameters:
  `row` -
Returns:
  null if the row was compacted away entirely; otherwise, the PK index entry for this row

#### append

    public void append(DecoratedKey decoratedKey,
              ColumnFamily cf)

#### rawAppend

    public static RowIndexEntry rawAppend(ColumnFamily cf,
                          long startPosition,
                          DecoratedKey key,
                          java.io.DataOutput out)
                                   throws java.io.IOException

Throws:
  `java.io.IOException`

#### appendFromStream

    public long appendFromStream(DecoratedKey key,
                        CFMetaData metadata,
                        java.io.DataInput in,
                        Descriptor.Version version)
                          throws java.io.IOException

Throws:
  `java.io.IOException` - if a read from the DataInput fails
  `FSWriteError` - if a write to the dataFile fails

#### abort

    public void abort()

After failure, attempt to close the index writer and data file before deleting all temp components for the sstable

#### closeAndOpenReader

    public SSTableReader closeAndOpenReader()

#### closeAndOpenReader

    public SSTableReader closeAndOpenReader(long maxDataAge)

#### close

    public Pair<Descriptor,SSTableMetadata> close()

#### rename

    public static void rename(Descriptor tmpdesc,
              Descriptor newdesc,
              java.util.Set<Component> components)

#### getFilePointer

    public long getFilePointer()

#### getOnDiskFilePointer

    public long getOnDiskFilePointer()