org.apache.cassandra.streaming

## Class StreamReader

- java.lang.Object
- - org.apache.cassandra.streaming.StreamReader

Direct Known Subclasses:
  CompressedStreamReader

    public class StreamReader
    extends java.lang.Object

StreamReader reads from stream and writes to SSTable.

### Field Summary

Fields
`protected java.util.UUID` `cfId`
`protected Descriptor` `desc`
`protected long` `estimatedKeys`
`protected Descriptor.Version` `inputVersion`
`protected long` `repairedAt`
`protected java.util.Collection<Pair<java.lang.Long,java.lang.Long>>` `sections`
`protected StreamSession` `session`

### Constructor Summary

Constructors
Constructor and Description
`StreamReader(FileMessageHeader header, StreamSession session)`

### Method Summary

Methods
`protected SSTableWriter` `createWriter(ColumnFamilyStore cfs, long totalSize, long repairedAt)`
`protected void` `drain(java.io.InputStream dis, long bytesRead)`
`SSTableWriter` `read(java.nio.channels.ReadableByteChannel channel)`
`protected long` `totalSize()`
`protected void` `writeRow(SSTableWriter writer, java.io.DataInput in, ColumnFamilyStore cfs)`

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

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

### Field Detail

#### cfId

    protected final java.util.UUID cfId

#### estimatedKeys

    protected final long estimatedKeys

#### sections

    protected final java.util.Collection<Pair<java.lang.Long,java.lang.Long>> sections

#### session

    protected final StreamSession session

#### inputVersion

    protected final Descriptor.Version inputVersion

#### repairedAt

    protected final long repairedAt

#### desc

    protected Descriptor desc

### Constructor Detail

#### StreamReader

    public StreamReader(FileMessageHeader header,
                StreamSession session)

### Method Detail

#### read

    public SSTableWriter read(java.nio.channels.ReadableByteChannel channel)
                       throws java.io.IOException

Parameters:
  `channel` - where this reads data from
Returns:
  SSTable transferred
Throws:
  `java.io.IOException` - if reading the remote sstable fails. Will throw an RTE if local write fails.

#### createWriter

    protected SSTableWriter createWriter(ColumnFamilyStore cfs,
                             long totalSize,
                             long repairedAt)
                                  throws java.io.IOException

Throws:
  `java.io.IOException`

#### drain

    protected void drain(java.io.InputStream dis,
             long bytesRead)
                  throws java.io.IOException

Throws:
  `java.io.IOException`

#### totalSize

    protected long totalSize()

#### writeRow

    protected void writeRow(SSTableWriter writer,
                java.io.DataInput in,
                ColumnFamilyStore cfs)
                     throws java.io.IOException

Throws:
  `java.io.IOException`