org.ccnx.ccn.io.CCNDescriptor Class Reference

A file descriptor-style wrapper around CCNVersionedInputStream and CCNVersionedOutputStream. More...

List of all members.

Public Types

enum  OpenMode { O_RDONLY, O_WRONLY }
enum  SeekWhence { SEEK_SET, SEEK_CUR, SEEK_END }

Public Member Functions

 CCNDescriptor (ContentName name, PublisherPublicKeyDigest publisher, CCNHandle handle, boolean openForWriting) throws IOException
 Open a new descriptor for reading or writing (but not both).
int available () throws IOException
boolean openForReading ()
boolean openForWriting ()
void close () throws IOException
 Close underlying stream.
void flush () throws IOException
 Flush output stream if open for writing.
boolean eof ()
int read (byte[] buf, int offset, int len) throws IOException
 See CCNInputStream.read(byte[], int, int).
int read (byte[] b) throws IOException
 See CCNInputStream.read(byte[]).
void write (byte[] buf, int offset, int len) throws IOException
 See CCNOutputStream.writeToNetwork(byte[], long, long).
void setTimeout (int timeout)
 Sets the timeout for the underlying stream.

Protected Member Functions

void openForReading (ContentName name, PublisherPublicKeyDigest publisher, CCNHandle handle) throws IOException
void openForWriting (ContentName name, PublisherPublicKeyDigest publisher, CCNHandle handle) throws IOException

Protected Attributes

CCNInputStream _input = null
CCNOutputStream _output = null


Detailed Description

A file descriptor-style wrapper around CCNVersionedInputStream and CCNVersionedOutputStream.

Constructor & Destructor Documentation

org.ccnx.ccn.io.CCNDescriptor.CCNDescriptor ( ContentName  name,
PublisherPublicKeyDigest  publisher,
CCNHandle  handle,
boolean  openForWriting 
) throws IOException

Open a new descriptor for reading or writing (but not both).

Parameters:
name see CCNVersionedInputStream for specification
publisher see CCNVersionedInputStream for specification
handle see CCNVersionedInputStream for specification
openForWriting if true, open an output stream. Otherwise open an input stream.
Exceptions:
IOException 


Member Function Documentation

int org.ccnx.ccn.io.CCNDescriptor.available (  )  throws IOException

Returns:
If open for reading, returns result of CCNInputStream.available(), otherwise returns 0.
Exceptions:
IOException 

boolean org.ccnx.ccn.io.CCNDescriptor.openForReading (  ) 

Returns:
true if opened for reading

boolean org.ccnx.ccn.io.CCNDescriptor.openForWriting (  ) 

Returns:
true if opened for writing

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

Close underlying stream.

Exceptions:
IOException 

void org.ccnx.ccn.io.CCNDescriptor.flush (  )  throws IOException

Flush output stream if open for writing.

Exceptions:
IOException 

boolean org.ccnx.ccn.io.CCNDescriptor.eof (  ) 

Returns:
true if open for reading and CCNInputStream.eof().

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

Sets the timeout for the underlying stream.

Parameters:
timeout in msec


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

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