net.netheos.pcsapi.bytesio
Class MemoryByteSink

java.lang.Object
  extended by net.netheos.pcsapi.bytesio.MemoryByteSink
All Implemented Interfaces:
ByteSink

public class MemoryByteSink
extends Object
implements ByteSink

Implementation of ByteSource in memory


Constructor Summary
MemoryByteSink()
           
 
Method Summary
 byte[] getData()
          Get the data stored in the sink
 ByteSinkStream openStream()
          Returns a ByteSinkStream object for writing data, to be closed by caller.
 void setExpectedLength(long expectedLength)
          Defines the number of bytes that are expected to be written to the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryByteSink

public MemoryByteSink()
Method Detail

openStream

public ByteSinkStream openStream()
Description copied from interface: ByteSink
Returns a ByteSinkStream object for writing data, to be closed by caller. This method may be called several times (in case of retries)"

Specified by:
openStream in interface ByteSink
Returns:
ByteSinkStream

setExpectedLength

public void setExpectedLength(long expectedLength)
Description copied from interface: ByteSink
Defines the number of bytes that are expected to be written to the stream. This value may be defined lately (after stream creation)

Note that this length may differ from the final data size, for example if bytes are appended to an already existing file.

Specified by:
setExpectedLength in interface ByteSink

getData

public byte[] getData()
Get the data stored in the sink

Returns:
The stored data


Copyright © 2014. All Rights Reserved.