me.prettyprint.cassandra.io
Class ChunkOutputStream<T>

java.lang.Object
  extended by java.io.OutputStream
      extended by me.prettyprint.cassandra.io.ChunkOutputStream<T>
All Implemented Interfaces:
Closeable, Flushable

public class ChunkOutputStream<T>
extends OutputStream

Provide an OutputStream which will write to a row. The written data will be split up by chunks of the given chunkSize. Each chunk we get written to own column which will have the chunk number (starting at 0) as column key (Long). This implementation is not thread-safe!


Constructor Summary
ChunkOutputStream(Keyspace keyspace, String cf, T key, Serializer<T> keySerializer, int chunkSize)
           
 
Method Summary
 void close()
           
 void flush()
          Trigger a flush.
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkOutputStream

public ChunkOutputStream(Keyspace keyspace,
                         String cf,
                         T key,
                         Serializer<T> keySerializer,
                         int chunkSize)
Method Detail

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

flush

public void flush()
           throws IOException
Trigger a flush. This will only write the content to the column if the chunk size is reached

Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException


Copyright © 2011. All Rights Reserved.