org.ccnx.ccn.io.CCNAbstractOutputStream Class Reference

This abstract class is the superclass of all classes for writing an output stream of bytes segmented and stored in CCN. More...

List of all members.

Public Member Functions

 CCNAbstractOutputStream (ContentName baseName, KeyLocator locator, PublisherPublicKeyDigest publisher, ContentType type, ContentKeys keys, CCNSegmenter segmenter)
 Base constructor for all output streams.
void addOutstandingInterest (Interest outstandingInterest)
 Method for streams used by CCNFilterListeners to output a block in response to an Interest callback.
void write (byte[] b) throws IOException
void write (int b) throws IOException
ContentName getBaseName ()
CCNTime getVersion ()
ContentType getType ()
ContentObject getFirstSegment ()
 Return the first segment of this stream.
byte[] getFirstDigest ()
 Returns the digest of the first segment of this stream.
Long firstSegmentNumber ()
 Returns the first segment number for this stream.
void setTimeout (int timeout)
 Set the timeout that will be used for all content writes on this stream.

Protected Member Functions

 CCNAbstractOutputStream ()
 Special purpose constructor used in tests.
void startWrite () throws IOException
 Override in subclasses that need to do something special with start writes (see CCNFlowControl.startWrite(ContentName, Shape)).
CCNSegmenter getSegmenter ()

Protected Attributes

CCNHandle _handle = null
CCNSegmenter _segmenter = null
ContentName _baseName = null
 The name for the content fragments, up to just before the sequence number.
ContentType _type
 type of content null == DATA (or ENCR if encrypted)
ContentKeys _keys
KeyLocator _locator
PublisherPublicKeyDigest _publisher

Detailed Description

This abstract class is the superclass of all classes for writing an output stream of bytes segmented and stored in CCN.

See also:
SegmentationProfile for description of CCN segmentation

Constructor & Destructor Documentation

org.ccnx.ccn.io.CCNAbstractOutputStream.CCNAbstractOutputStream ( ContentName  baseName,
KeyLocator  locator,
PublisherPublicKeyDigest  publisher,
ContentType  type,
ContentKeys  keys,
CCNSegmenter  segmenter 
)

Base constructor for all output streams.

The behavior of an output stream derived class is determined largely by its buffering, segmentation configuration (embodied in a CCNSegmenter) and flow control (embodied in a CCNFlowControl, contained within the segmenter), as well as the way it constructs is names.

Parameters:
baseName specifies the base name to write. Can be null, and set later.
type specifies the type of data to write.
locator the key locator to be used in written segments. If null, default is used.
publisher the key with which to sign the output. If null, default for user is used.
segmenter The segmenter used to construct and sign output segments, specified by subclasses to provide various kinds of behavior.

Member Function Documentation

void org.ccnx.ccn.io.CCNAbstractOutputStream.addOutstandingInterest ( Interest  outstandingInterest  ) 

Method for streams used by CCNFilterListeners to output a block in response to an Interest callback.

We've received an Interest prior to setting up this stream. Use a method to push this Interest, rather than passing it in in the constructor to make sure we have completed initializing the stream, and to limit the number of constructor types. (If the Interest doesn't match this stream's content, no initial block will be output; the stream will wait for matching Interests prior to writing its blocks.)

Parameters:
outstandingInterest An interest received prior to constructing this stream, ideally on the same CCNHandle that the stream is using for output. Only one stream should attempt to put() a block in response to this Interest; it is up to the caller to make sure that is the case.
Long org.ccnx.ccn.io.CCNAbstractOutputStream.firstSegmentNumber (  ) 

Returns the first segment number for this stream.

Returns:
The index of the first segment of stream data or null if no segments generated yet.
ContentName org.ccnx.ccn.io.CCNAbstractOutputStream.getBaseName (  ) 
Returns:
The name used as a prefix for segments of this stream (not including the segment number).
byte [] org.ccnx.ccn.io.CCNAbstractOutputStream.getFirstDigest (  ) 

Returns the digest of the first segment of this stream.

Returns:
The digest of the first segment of this stream or null if no segments generated yet.
ContentObject org.ccnx.ccn.io.CCNAbstractOutputStream.getFirstSegment (  ) 

Return the first segment of this stream.

Returns:
The first segment of this stream or null if no segments generated yet
CCNSegmenter org.ccnx.ccn.io.CCNAbstractOutputStream.getSegmenter (  )  [protected]
Returns:
The CCNSegmenter responsible for segmenting and signing stream content.
CCNTime org.ccnx.ccn.io.CCNAbstractOutputStream.getVersion (  ) 
Returns:
The version of the stream being written, if its name is versioned.
void org.ccnx.ccn.io.CCNAbstractOutputStream.setTimeout ( int  timeout  ) 

Set the timeout that will be used for all content writes on this stream.

Default is 10 seconds

Parameters:
timeout in milliseconds
void org.ccnx.ccn.io.CCNAbstractOutputStream.startWrite (  )  throws IOException [protected]

Override in subclasses that need to do something special with start writes (see CCNFlowControl.startWrite(ContentName, Shape)).

They should call this superclass method, though, to initialize keys (may need to move this later).

Exceptions:
IOException 

Reimplemented in org.ccnx.ccn.io.CCNOutputStream.


The documentation for this class was generated from the following file:
Generated on Fri May 13 16:27:43 2011 for Content-Centric Networking in Java by  doxygen 1.6.3