org.ccnx.ccn.io.CCNWriter Class Reference

Simplest interface to putting data into CCN. More...

Inheritance diagram for org.ccnx.ccn.io.CCNWriter:

org.ccnx.ccn.io.CCNRepositoryWriter

List of all members.

Public Member Functions

 CCNWriter (String namespace, CCNHandle handle) throws MalformedContentNameStringException, IOException
 Construct a writer that will write content into a certain namespace.
 CCNWriter (ContentName namespace, CCNHandle handle) throws IOException
 Construct a writer that will write content into a certain namespace.
 CCNWriter (CCNHandle handle) throws IOException
 Construct a writer that will decide later what namespace is should write into.
ContentName put (String name, String content) throws SignatureException, MalformedContentNameStringException, IOException
 Publish a piece of named content signed by our default identity.
ContentName put (ContentName name, String content) throws SignatureException, MalformedContentNameStringException, IOException
 Publish a piece of named content signed by our default identity.
ContentName put (ContentName name, byte[] content) throws SignatureException, IOException
 Publish a piece of named content signed by our default identity.
ContentName put (ContentName name, byte[] content, ContentKeys keys) throws SignatureException, IOException
 Publish a piece of named content signed by our default identity.
ContentName put (ContentName name, byte[] content, Interest outstandingInterest) throws SignatureException, IOException
 Publish a piece of named content signed by our default identity in response to an already-received Interest.
ContentName put (ContentName name, byte[] content, PublisherPublicKeyDigest publisher) throws SignatureException, IOException
 Publish a piece of named content signed by a particular identity.
ContentName put (ContentName name, String content, Integer freshnessSeconds) throws SignatureException, MalformedContentNameStringException, IOException
 Publish a piece of named content signed by our default identity.
ContentName put (ContentName name, byte[] content, SignedInfo.ContentType type, PublisherPublicKeyDigest publisher, ContentKeys keys) throws SignatureException, IOException
 Publish a piece of named content signed by a particular identity.
ContentName put (ContentName name, byte[] content, SignedInfo.ContentType type, PublisherPublicKeyDigest publisher, Integer freshnessSeconds, ContentKeys keys) throws SignatureException, IOException
 Publish a piece of named content signed by a particular identity.
ContentName put (ContentName name, byte[] content, SignedInfo.ContentType type, PublisherPublicKeyDigest publisher, KeyLocator locator, Integer freshnessSeconds, ContentKeys keys, Interest outstandingInterest) throws SignatureException, IOException
 Publish a piece of named content signed by a particular identity.
ContentName newVersion (ContentName name, byte[] content) throws SignatureException, IOException, InvalidKeyException, NoSuchAlgorithmException, InvalidAlgorithmParameterException
 Publishes a piece of content as a new version of a given name.
ContentName newVersion (ContentName name, byte[] content, PublisherPublicKeyDigest publisher, ContentKeys keys) throws SignatureException, IOException, InvalidKeyException, NoSuchAlgorithmException, InvalidAlgorithmParameterException
 Publishes a piece of content as a new version of a given name.
ContentName newVersion (ContentName name, byte[] content, ContentType type, KeyLocator locator, PublisherPublicKeyDigest publisher, ContentKeys keys) throws SignatureException, InvalidKeyException, NoSuchAlgorithmException, IOException, InvalidAlgorithmParameterException
 Publishes a piece of content as a new version of a given name.
void addOutstandingInterest (Interest outstandingInterest)
 Method for writers used by CCNFilterListeners to output a block in response to an Interest callback.
void disableFlowControl ()
 Turn off flow control.
void close () throws IOException
 Close this writer, ensuring all buffers are clear.
void setTimeout (int timeout)
 Set the default timeout for this writer.

Protected Member Functions

CCNFlowControl getFlowController (ContentName namespace, CCNHandle handle) throws IOException
 Create our flow controller.
 CCNWriter (CCNFlowControl flowControl)
 Low-level constructor used by implementation.
CCNFlowControl getFlowControl ()

Protected Attributes

CCNSegmenter _segmenter


Detailed Description

Simplest interface to putting data into CCN.

Puts buffers of data, optionally fragmenting them if need be. Useful for writing small test programs, however more complex clients will usually prefer the higher-level interfaces offered by CCNOutputStream and its subclasses, or CCNNetworkObject and its subclasses.


Constructor & Destructor Documentation

org.ccnx.ccn.io.CCNWriter.CCNWriter ( String  namespace,
CCNHandle  handle 
) throws MalformedContentNameStringException, IOException

Construct a writer that will write content into a certain namespace.

Names specified in calls to put should be descendants of this namespace.

Parameters:
namespace The parent namespace this writer will write to as a file path-style string version of a name (for example /org/ccnx/test).
handle The ccn context it will use to write, if null one will be created with CCNHandle.open().
Exceptions:
MalformedContentNameStringException If namespace cannot be parsed.
IOException If network initialization fails.

org.ccnx.ccn.io.CCNWriter.CCNWriter ( ContentName  namespace,
CCNHandle  handle 
) throws IOException

Construct a writer that will write content into a certain namespace.

Names specified in calls to put should be descendants of this namespace.

Parameters:
namespace The parent namespace this writer will write to.
handle The ccn context it will use to write, if null one will be created with CCNHandle.open().
Exceptions:
MalformedContentNameStringException If namespace cannot be parsed.
IOException If network initialization fails.

org.ccnx.ccn.io.CCNWriter.CCNWriter ( CCNHandle  handle  )  throws IOException

Construct a writer that will decide later what namespace is should write into.

Parameters:
handle The ccn context it will use to write, if null one will be created with CCNHandle.open().
Exceptions:
IOException If network initialization fails.

org.ccnx.ccn.io.CCNWriter.CCNWriter ( CCNFlowControl  flowControl  )  [protected]

Low-level constructor used by implementation.

Parameters:
flowControl Output buffer.


Member Function Documentation

CCNFlowControl org.ccnx.ccn.io.CCNWriter.getFlowController ( ContentName  namespace,
CCNHandle  handle 
) throws IOException [protected]

Create our flow controller.

Allow subclass override.

Parameters:
namespace 
handle 
Returns:
Exceptions:
IOException 

Reimplemented in org.ccnx.ccn.io.CCNRepositoryWriter.

ContentName org.ccnx.ccn.io.CCNWriter.put ( String  name,
String  content 
) throws SignatureException, MalformedContentNameStringException, IOException

Publish a piece of named content signed by our default identity.

Parameters:
name name for content.
content content to publish; will be fragmented if necessary.
Exceptions:
SignatureException if there is a problem signing.
IOException if there is a problem writing data.

ContentName org.ccnx.ccn.io.CCNWriter.put ( ContentName  name,
String  content 
) throws SignatureException, MalformedContentNameStringException, IOException

Publish a piece of named content signed by our default identity.

Parameters:
name name for content.
content content to publish; will be fragmented if necessary.
Exceptions:
SignatureException if there is a problem signing.
IOException if there is a problem writing data.

ContentName org.ccnx.ccn.io.CCNWriter.put ( ContentName  name,
byte[]  content 
) throws SignatureException, IOException

Publish a piece of named content signed by our default identity.

Parameters:
name name for content.
content content to publish; will be fragmented if necessary.
Exceptions:
SignatureException if there is a problem signing.
IOException if there is a problem writing data.

ContentName org.ccnx.ccn.io.CCNWriter.put ( ContentName  name,
byte[]  content,
ContentKeys  keys 
) throws SignatureException, IOException

Publish a piece of named content signed by our default identity.

Parameters:
name name for content.
content content to publish; will be fragmented if necessary.
keys the keys with which to encrypt the content (if non-null)
Exceptions:
SignatureException if there is a problem signing.
IOException if there is a problem writing data.

ContentName org.ccnx.ccn.io.CCNWriter.put ( ContentName  name,
byte[]  content,
Interest  outstandingInterest 
) throws SignatureException, IOException

Publish a piece of named content signed by our default identity in response to an already-received Interest.

The first block of Data will be written immediately, if name matches this Interest; otherwise both Data and Interest will be held pending later matches.

Parameters:
name name for content.
content content to publish; will be fragmented if necessary.
outstandingInterest an Interest, usually received by the handleInterests method of a CCNFilterListener. Only one responder should write data in response to a given Interest. The Interest should ideally have been received on the same CCNHandle used by this CCNWriter to write data.
Exceptions:
SignatureException if there is a problem signing.
IOException if there is a problem writing data.

ContentName org.ccnx.ccn.io.CCNWriter.put ( ContentName  name,
byte[]  content,
PublisherPublicKeyDigest  publisher 
) throws SignatureException, IOException

Publish a piece of named content signed by a particular identity.

Parameters:
name name for content.
content content to publish; will be fragmented if necessary.
publisher selects one of our identities to publish under
Exceptions:
SignatureException if there is a problem signing.
IOException if there is a problem writing data.

ContentName org.ccnx.ccn.io.CCNWriter.put ( ContentName  name,
String  content,
Integer  freshnessSeconds 
) throws SignatureException, MalformedContentNameStringException, IOException

Publish a piece of named content signed by our default identity.

Parameters:
name name for content.
content content to publish; will be fragmented if necessary.
freshnessSeconds how long the content should be considered valid in the cache.
Exceptions:
SignatureException if there is a problem signing.
IOException if there is a problem writing data.

ContentName org.ccnx.ccn.io.CCNWriter.put ( ContentName  name,
byte[]  content,
SignedInfo.ContentType  type,
PublisherPublicKeyDigest  publisher,
ContentKeys  keys 
) throws SignatureException, IOException

Publish a piece of named content signed by a particular identity.

Parameters:
name name for content.
content content to publish; will be fragmented if necessary.
type type to specify for content. If null, DATA will be used. (see ContentType).
publisher selects one of our identities to publish under
Exceptions:
SignatureException if there is a problem signing.
IOException if there is a problem writing data.

ContentName org.ccnx.ccn.io.CCNWriter.put ( ContentName  name,
byte[]  content,
SignedInfo.ContentType  type,
PublisherPublicKeyDigest  publisher,
Integer  freshnessSeconds,
ContentKeys  keys 
) throws SignatureException, IOException

Publish a piece of named content signed by a particular identity.

Parameters:
name name for content.
content content to publish; will be fragmented if necessary
type type to specify for content. If null, DATA will be used. (see ContentType).
publisher selects one of our identities to publish under
freshnessSeconds how long the content should be considered valid in the cache.
Exceptions:
SignatureException if there is a problem signing.
IOException if there is a problem writing data.

ContentName org.ccnx.ccn.io.CCNWriter.put ( ContentName  name,
byte[]  content,
SignedInfo.ContentType  type,
PublisherPublicKeyDigest  publisher,
KeyLocator  locator,
Integer  freshnessSeconds,
ContentKeys  keys,
Interest  outstandingInterest 
) throws SignatureException, IOException

Publish a piece of named content signed by a particular identity.

Parameters:
name name for content.
content content to publish; will be fragmented if necessary
type type to specify for content. If null, DATA will be used. (see ContentType).
publisher selects one of our identities to publish under
freshnessSeconds how long the content should be considered valid in the cache.
outstandingInterest an interest this data is being written in response to. If the name matches the Interest, the first Data segment of the content will be written immediately. Otherwise both Interest and Data will be cached.
Exceptions:
SignatureException if there is a problem signing.
IOException if there is a problem writing data.

ContentName org.ccnx.ccn.io.CCNWriter.newVersion ( ContentName  name,
byte[]  content 
) throws SignatureException, IOException, InvalidKeyException, NoSuchAlgorithmException, InvalidAlgorithmParameterException

Publishes a piece of content as a new version of a given name.

Parameters:
name The (unversioned) name to publish under.
content The content to publish, which will be segmented if necessary.
Exceptions:
SignatureException if cannot sign
InvalidKeyException if cannot sign with specified key.
NoSuchAlgorithmException if algorithm specified does not exist.
IOException if cannot write data successfully.
InvalidAlgorithmParameterException if there is a problem with the cryptographic parameters.

ContentName org.ccnx.ccn.io.CCNWriter.newVersion ( ContentName  name,
byte[]  content,
PublisherPublicKeyDigest  publisher,
ContentKeys  keys 
) throws SignatureException, IOException, InvalidKeyException, NoSuchAlgorithmException, InvalidAlgorithmParameterException

Publishes a piece of content as a new version of a given name.

Parameters:
name The (unversioned) name to publish under.
content The content to publish, which will be segmented if necessary.
publisher Specifies what key the content should be signed by.
Exceptions:
SignatureException if cannot sign
InvalidKeyException if cannot sign with specified key.
NoSuchAlgorithmException if algorithm specified does not exist.
IOException if cannot write data successfully.
InvalidAlgorithmParameterException if there is a problem with the cryptographic parameters.

ContentName org.ccnx.ccn.io.CCNWriter.newVersion ( ContentName  name,
byte[]  content,
ContentType  type,
KeyLocator  locator,
PublisherPublicKeyDigest  publisher,
ContentKeys  keys 
) throws SignatureException, InvalidKeyException, NoSuchAlgorithmException, IOException, InvalidAlgorithmParameterException

Publishes a piece of content as a new version of a given name.

Parameters:
name The (unversioned) name to publish under.
content The content to publish, which will be segmented if necessary.
type The type to publish the content as.
locator The key locator to used to help consumers find the key used to sign.
publisher Specifies what key the content should be signed by.
Exceptions:
SignatureException if cannot sign
InvalidKeyException if cannot sign with specified key.
NoSuchAlgorithmException if algorithm specified does not exist.
IOException if cannot write data successfully.
InvalidAlgorithmParameterException if there is a problem with the cryptographic parameters.

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

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

We've received an Interest prior to setting up this writer. Use a method to push this Interest, rather than passing it in in the constructor to make sure we have completed initializing the writer, and to limit the number of constructor types. (Similarly, we don't want to have to repeat each put() in versions that either do or don't take an Interest argument, or add potentially confusing Interest arguments to some/all of the put() methods that should usually be null. So start with this as the simplest option.) If the Interest doesn't match this writer's content, no initial block will be output; the writer will wait for matching Interests prior to writing its blocks. The Interest will be cached in case future content written to this CCNWriter does match it.

Parameters:
outstandingInterest An interest received prior to constructing this writer, ideally on the same CCNHandle that the stream is using for output. Only one block should be put() in response to this Interest; it is up to the caller to make sure that is the case.

CCNFlowControl org.ccnx.ccn.io.CCNWriter.getFlowControl (  )  [protected]

Returns:
internal flow buffer.

void org.ccnx.ccn.io.CCNWriter.disableFlowControl (  ) 

Turn off flow control.

Warning - calling this risks packet drops. It should only be used for tests or other special circumstances in which you "know what you are doing".

void org.ccnx.ccn.io.CCNWriter.close (  )  throws IOException

Close this writer, ensuring all buffers are clear.

Exceptions:
IOException If readers do not empty the buffer.

void org.ccnx.ccn.io.CCNWriter.setTimeout ( int  timeout  ) 

Set the default timeout for this writer.

Default is 10 seconds

Parameters:
timeout in msec.


The documentation for this class was generated from the following file:

Generated on Thu Feb 16 00:45:01 2012 for Content-Centric Networking in Java by  doxygen 1.5.6