ccs.cdb
Interface CallbackStreamConsumer


public interface CallbackStreamConsumer

The object can consume a stream via a callback method. This pattern allows large objects to be read from a CDBeeTree (in particular) with no copy, eliminating the otherwise large latency while the object is copied out into a SwappingBuffer (which will). However, there is a price to pay: firstly, the affected CDBeeTree object will block until the read is complete, which is likely to be a while if the consumer is streaming it to a client. Secondly, if the stream is corrupt, this won't be known until it has all been sent. Accordingly, this is not recommended for objects which have been individually encrypted - it won't be known whether the password was wrong until an entire stream of random garbage has been sent back.


Method Summary
 void consumeStream(java.io.InputStream is)
          Consume the stream.
 

Method Detail

consumeStream

void consumeStream(java.io.InputStream is)
                   throws java.io.IOException
Consume the stream. Typically this involves pushing it to someone else.

Parameters:
is - The stream to consume. Do not close it - this is not your job.
Throws:
java.io.IOException