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 |
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.
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. |
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).
IOException |
Reimplemented in org.ccnx.ccn.io.CCNOutputStream.
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.)
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. |
ContentName org.ccnx.ccn.io.CCNAbstractOutputStream.getBaseName | ( | ) |
CCNTime org.ccnx.ccn.io.CCNAbstractOutputStream.getVersion | ( | ) |
ContentObject org.ccnx.ccn.io.CCNAbstractOutputStream.getFirstSegment | ( | ) |
Return the first segment of this stream.
byte [] org.ccnx.ccn.io.CCNAbstractOutputStream.getFirstDigest | ( | ) |
Returns the digest of the first segment of this stream.
Long org.ccnx.ccn.io.CCNAbstractOutputStream.firstSegmentNumber | ( | ) |
Returns the first segment number for this stream.
CCNSegmenter org.ccnx.ccn.io.CCNAbstractOutputStream.getSegmenter | ( | ) | [protected] |
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
timeout | in milliseconds |