org.apache.cassandra.io.sstable

## Class AbstractSSTableSimpleWriter

- java.lang.Object
- - org.apache.cassandra.io.sstable.AbstractSSTableSimpleWriter

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

Direct Known Subclasses:
  SSTableSimpleUnsortedWriter, SSTableSimpleWriter

    public abstract class AbstractSSTableSimpleWriter
    extends java.lang.Object
    implements java.io.Closeable

### Field Summary

Fields
`protected ColumnFamily` `columnFamily`
`protected CounterId` `counterid`
`protected DecoratedKey` `currentKey`
`protected java.nio.ByteBuffer` `currentSuperColumn`
`protected java.io.File` `directory`
`protected static java.util.concurrent.atomic.AtomicInteger` `generation`
`protected CFMetaData` `metadata`

### Constructor Summary

Constructors
Constructor and Description
`AbstractSSTableSimpleWriter(java.io.File directory, CFMetaData metadata, IPartitioner partitioner)`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`void` `addColumn(java.nio.ByteBuffer name, java.nio.ByteBuffer value, long timestamp)` Insert a new "regular" column to the current row (and super column if applicable).
`protected void` `addColumn(Cell cell)`
`void` `addCounterColumn(java.nio.ByteBuffer name, long value)` Insert a new counter column to the current row (and super column if applicable).
`void` `addExpiringColumn(java.nio.ByteBuffer name, java.nio.ByteBuffer value, long timestamp, int ttl, long expirationTimestampMS)` Insert a new expiring column to the current row (and super column if applicable).
`protected static Descriptor` `createDescriptor(java.io.File directory, java.lang.String keyspace, java.lang.String columnFamily, SSTableFormat.Type fmt)`
`protected abstract ColumnFamily` `getColumnFamily()`
`abstract Descriptor` `getCurrentDescriptor()`
`protected SSTableWriter` `getWriter()`
`void` `newRow(java.nio.ByteBuffer key)` Start a new row whose key is `key`.
`void` `newSuperColumn(java.nio.ByteBuffer name)` Start a new super column with name `name`.
`protected void` `setSSTableFormatType(SSTableFormat.Type type)`
`protected abstract void` `writeRow(DecoratedKey key, ColumnFamily columnFamily)`

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

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

### Methods inherited from interface java.io.Closeable

`close`

### Field Detail

#### directory

    protected final java.io.File directory

#### metadata

    protected final CFMetaData metadata

#### currentKey

    protected DecoratedKey currentKey

#### columnFamily

    protected ColumnFamily columnFamily

#### currentSuperColumn

    protected java.nio.ByteBuffer currentSuperColumn

#### counterid

    protected final CounterId counterid

#### generation

    protected static java.util.concurrent.atomic.AtomicInteger generation

### Constructor Detail

#### AbstractSSTableSimpleWriter

    public AbstractSSTableSimpleWriter(java.io.File directory,
                                       CFMetaData metadata,
                                       IPartitioner partitioner)

### Method Detail

#### setSSTableFormatType

    protected void setSSTableFormatType(SSTableFormat.Type type)

#### getWriter

    protected SSTableWriter getWriter()

#### createDescriptor

    protected static Descriptor createDescriptor(java.io.File directory,
                                                 java.lang.String keyspace,
                                                 java.lang.String columnFamily,
                                                 SSTableFormat.Type fmt)

#### newRow

    public void newRow(java.nio.ByteBuffer key)
                throws java.io.IOException

Start a new row whose key is `key`.

Parameters:
  `key` - the row key
Throws:
  `java.io.IOException`

#### newSuperColumn

    public void newSuperColumn(java.nio.ByteBuffer name)

Start a new super column with name `name`.

Parameters:
  `name` - the name for the super column

#### addColumn

    protected void addColumn(Cell cell)
                      throws java.io.IOException

Throws:
  `java.io.IOException`

#### addColumn

    public void addColumn(java.nio.ByteBuffer name,
                          java.nio.ByteBuffer value,
                          long timestamp)
                   throws java.io.IOException

Insert a new "regular" column to the current row (and super column if applicable).

Parameters:
  `name` - the column name
  `value` - the column value
  `timestamp` - the column timestamp
Throws:
  `java.io.IOException`

#### addExpiringColumn

    public void addExpiringColumn(java.nio.ByteBuffer name,
                                  java.nio.ByteBuffer value,
                                  long timestamp,
                                  int ttl,
                                  long expirationTimestampMS)
                           throws java.io.IOException

Insert a new expiring column to the current row (and super column if applicable).

Parameters:
  `name` - the column name
  `value` - the column value
  `timestamp` - the column timestamp
  `ttl` - the column time to live in seconds
  `expirationTimestampMS` - the local expiration timestamp in milliseconds. This is the server time timestamp used for actually expiring the column, and as a consequence should be synchronized with the cassandra servers time. If `timestamp` represents the insertion time in microseconds (which is not required), this should be `(timestamp / 1000) + (ttl * 1000)`.
Throws:
  `java.io.IOException`

#### addCounterColumn

    public void addCounterColumn(java.nio.ByteBuffer name,
                                 long value)
                          throws java.io.IOException

Insert a new counter column to the current row (and super column if applicable).

Parameters:
  `name` - the column name
  `value` - the value of the counter
Throws:
  `java.io.IOException`

#### writeRow

    protected abstract void writeRow(DecoratedKey key,
                                     ColumnFamily columnFamily)
                              throws java.io.IOException

Throws:
  `java.io.IOException`

#### getColumnFamily

    protected abstract ColumnFamily getColumnFamily()
                                             throws java.io.IOException

Throws:
  `java.io.IOException`

#### getCurrentDescriptor

    public abstract Descriptor getCurrentDescriptor()