Public Member Functions | |
CCNFileInputStream (ContentName baseName) throws IOException | |
Set up an input stream to read segmented CCN content under a given versioned name. | |
CCNFileInputStream (ContentName baseName, CCNHandle handle) throws IOException | |
Set up an input stream to read segmented CCN content under a given versioned name. | |
CCNFileInputStream (ContentName baseName, PublisherPublicKeyDigest publisher, CCNHandle handle) throws IOException | |
Set up an input stream to read segmented CCN content under a given versioned name. | |
CCNFileInputStream (ContentName baseName, Long startingSegmentNumber, CCNHandle handle) throws IOException | |
Set up an input stream to read segmented CCN content under a given versioned name. | |
CCNFileInputStream (ContentName baseName, Long startingSegmentNumber, PublisherPublicKeyDigest publisher, CCNHandle handle) throws IOException | |
Set up an input stream to read segmented CCN content under a given versioned name. | |
CCNFileInputStream (ContentName baseName, Long startingSegmentNumber, PublisherPublicKeyDigest publisher, ContentKeys keys, CCNHandle handle) throws IOException | |
Set up an input stream to read segmented CCN content under a given versioned name. | |
CCNFileInputStream (ContentObject startingSegment, EnumSet< FlagTypes > flags, CCNHandle handle) throws IOException | |
Set up an input stream to read segmented CCN content starting with a given ContentObject that has already been retrieved. | |
CCNFileInputStream (ContentObject startingSegment, ContentKeys keys, EnumSet< FlagTypes > flags, CCNHandle handle) throws IOException | |
Set up an input stream to read segmented CCN content starting with a given ContentObject that has already been retrieved. | |
boolean | hasHeader () |
void | waitForHeader (Long timeout) throws ContentNotReadyException |
Callers who wish to access the header should call this first; it will wait until the header has been successfully retrieved (if the retrieval has started). | |
void | waitForHeader () throws ContentNotReadyException |
Header | header () throws ContentNotReadyException, ContentGoneException, ErrorStateException |
Accesses the header data if it has been requested. | |
ContentObject | getFirstSegment () throws IOException |
Once we have retrieved the first segment of this stream using CCNVersionedInputStream.getFirstSegment(), initiate header retrieval. | |
long | skip (long n) throws IOException |
void | seek (long position) throws IOException |
Seek a stream to a specific byte offset from the start. | |
long | tell () throws IOException |
long | length () throws IOException |
void | newVersionAvailable (CCNNetworkObject<?> newVersion, boolean wasSave) |
Notification when a new version is available of a given object (the object's data and version information will already have been updated to reflect the new version). | |
void | close () throws IOException |
Protected Member Functions | |
boolean | headerRequested () |
void | requestHeader (ContentName baseName, PublisherPublicKeyDigest publisher) throws ContentDecodingException, IOException |
Request the header in the background. | |
int | segmentCount () throws IOException |
Protected Attributes | |
HeaderObject | _header = null |
The header information for that object, once we've read it. | |
HeaderObject | _oldHeader = null |
Temporary backwards-compatibility move. |
See CCNVersionedInputStream for a description of versioning behavior, and CCNFileOutputStream for a description of header information. The header is read asynchronously, and may not be available at all until the complete stream has been written (in other words, the publisher typically writes the header last). Stream data can be read normally before the header has been read, and the consumer may opt to ignore the header completely, in which case this acts exactly like a CCNVersionedInputStream. In fact, a CCNVersionedInputStream can be used to read data read by CCNFileOutputStream (except for the header). Using a CCNFileInputStream to read something not written by a CCNFileOutputStream or one of its subclasses (in other words, something without a header) will still try to retrieve the (nonexistent) header in the background, but will not cause an error unless someone tries to access the header data itself.
Headers are named according to definitions in the SegmentationProfile.
org.ccnx.ccn.io.CCNFileInputStream.CCNFileInputStream | ( | ContentName | baseName | ) | throws IOException |
Set up an input stream to read segmented CCN content under a given versioned name.
Content is assumed to be unencrypted, or keys will be retrieved automatically via another process. Will use the default handle given by CCNHandle.getHandle(). Note that this constructor does not currently retrieve any data; data is not retrieved until read() is called. This will change in the future, and this constructor will retrieve the first block.
baseName | Name to read from. If it ends with a version, will retrieve that specific version. If not, will find the latest version available. If it ends with both a version and a segment number, will start to read from that segment of that version. |
IOException | Not currently thrown, will be thrown when constructors retrieve first block. |
org.ccnx.ccn.io.CCNFileInputStream.CCNFileInputStream | ( | ContentName | baseName, | |
CCNHandle | handle | |||
) | throws IOException |
Set up an input stream to read segmented CCN content under a given versioned name.
Content is assumed to be unencrypted, or keys will be retrieved automatically via another process. Will use the default handle given by CCNHandle.getHandle(). Note that this constructor does not currently retrieve any data; data is not retrieved until read() is called. This will change in the future, and this constructor will retrieve the first block.
baseName | Name to read from. If it ends with a version, will retrieve that specific version. If not, will find the latest version available. If it ends with both a version and a segment number, will start to read from that segment of that version. | |
handle | The CCN handle to use for data retrieval. If null, the default handle given by CCNHandle.getHandle() will be used. |
IOException | Not currently thrown, will be thrown when constructors retrieve first block. |
org.ccnx.ccn.io.CCNFileInputStream.CCNFileInputStream | ( | ContentName | baseName, | |
PublisherPublicKeyDigest | publisher, | |||
CCNHandle | handle | |||
) | throws IOException |
Set up an input stream to read segmented CCN content under a given versioned name.
Content is assumed to be unencrypted, or keys will be retrieved automatically via another process. Will use the default handle given by CCNHandle.getHandle(). Note that this constructor does not currently retrieve any data; data is not retrieved until read() is called. This will change in the future, and this constructor will retrieve the first block.
baseName | Name to read from. If it ends with a version, will retrieve that specific version. If not, will find the latest version available. If it ends with both a version and a segment number, will start to read from that segment of that version. | |
publisher | The key we require to have signed this content. If null, will accept any publisher (subject to higher-level verification). | |
handle | The CCN handle to use for data retrieval. If null, the default handle given by CCNHandle.getHandle() will be used. |
IOException | Not currently thrown, will be thrown when constructors retrieve first block. |
org.ccnx.ccn.io.CCNFileInputStream.CCNFileInputStream | ( | ContentName | baseName, | |
Long | startingSegmentNumber, | |||
CCNHandle | handle | |||
) | throws IOException |
Set up an input stream to read segmented CCN content under a given versioned name.
Content is assumed to be unencrypted, or keys will be retrieved automatically via another process. Will use the default handle given by CCNHandle.getHandle(). Note that this constructor does not currently retrieve any data; data is not retrieved until read() is called. This will change in the future, and this constructor will retrieve the first block.
baseName | Name to read from. If it ends with a version, will retrieve that specific version. If not, will find the latest version available. If it ends with both a version and a segment number, will start to read from that segment of that version. | |
startingSegmentNumber | Alternative specification of starting segment number. If null, will be SegmentationProfile.baseSegment(). | |
handle | The CCN handle to use for data retrieval. If null, the default handle given by CCNHandle.getHandle() will be used. |
IOException | Not currently thrown, will be thrown when constructors retrieve first block. |
org.ccnx.ccn.io.CCNFileInputStream.CCNFileInputStream | ( | ContentName | baseName, | |
Long | startingSegmentNumber, | |||
PublisherPublicKeyDigest | publisher, | |||
CCNHandle | handle | |||
) | throws IOException |
Set up an input stream to read segmented CCN content under a given versioned name.
Content is assumed to be unencrypted, or keys will be retrieved automatically via another process. Will use the default handle given by CCNHandle.getHandle(). Note that this constructor does not currently retrieve any data; data is not retrieved until read() is called. This will change in the future, and this constructor will retrieve the first block.
baseName | Name to read from. If it ends with a version, will retrieve that specific version. If not, will find the latest version available. If it ends with both a version and a segment number, will start to read from that segment of that version. | |
startingSegmentNumber | Alternative specification of starting segment number. If null, will be SegmentationProfile.baseSegment(). | |
publisher | The key we require to have signed this content. If null, will accept any publisher (subject to higher-level verification). | |
handle | The CCN handle to use for data retrieval. If null, the default handle given by CCNHandle.getHandle() will be used. |
IOException | Not currently thrown, will be thrown when constructors retrieve first block. |
org.ccnx.ccn.io.CCNFileInputStream.CCNFileInputStream | ( | ContentName | baseName, | |
Long | startingSegmentNumber, | |||
PublisherPublicKeyDigest | publisher, | |||
ContentKeys | keys, | |||
CCNHandle | handle | |||
) | throws IOException |
Set up an input stream to read segmented CCN content under a given versioned name.
Will use the default handle given by CCNHandle.getHandle(). Note that this constructor does not currently retrieve any data; data is not retrieved until read() is called. This will change in the future, and this constructor will retrieve the first block.
baseName | Name to read from. If it ends with a version, will retrieve that specific version. If not, will find the latest version available. If it ends with both a version and a segment number, will start to read from that segment of that version. | |
startingSegmentNumber | Alternative specification of starting segment number. If null, will be SegmentationProfile.baseSegment(). | |
publisher | The key we require to have signed this content. If null, will accept any publisher (subject to higher-level verification). | |
keys | The keys to use to decrypt this content. If null, assumes content unencrypted, or another process will be used to retrieve the keys. | |
handle | The CCN handle to use for data retrieval. If null, the default handle given by CCNHandle.getHandle() will be used. |
IOException | Not currently thrown, will be thrown when constructors retrieve first block. |
org.ccnx.ccn.io.CCNFileInputStream.CCNFileInputStream | ( | ContentObject | startingSegment, | |
EnumSet< FlagTypes > | flags, | |||
CCNHandle | handle | |||
) | throws IOException |
Set up an input stream to read segmented CCN content starting with a given ContentObject that has already been retrieved.
Content is assumed to be unencrypted, or keys will be retrieved automatically via another process.
startingSegment | The first segment to read from. If this is not the first segment of the stream, reading will begin from this point. We assume that the signature on this segment was verified by our caller. | |
flags | any stream flags that must be set to handle even this first block (otherwise they can be set with setFlags prior to read). Can be null. | |
handle | The CCN handle to use for data retrieval. If null, the default handle given by CCNHandle.getHandle() will be used. |
IOException |
org.ccnx.ccn.io.CCNFileInputStream.CCNFileInputStream | ( | ContentObject | startingSegment, | |
ContentKeys | keys, | |||
EnumSet< FlagTypes > | flags, | |||
CCNHandle | handle | |||
) | throws IOException |
Set up an input stream to read segmented CCN content starting with a given ContentObject that has already been retrieved.
startingSegment | The first segment to read from. If this is not the first segment of the stream, reading will begin from this point. We assume that the signature on this segment was verified by our caller. | |
keys | The keys to use to decrypt this content. Null if content unencrypted, or another process will be used to retrieve the keys. | |
flags | any stream flags that must be set to handle even this first block (otherwise they can be set with setFlags prior to read). Can be null. | |
handle | The CCN handle to use for data retrieval. If null, the default handle given by CCNHandle.getHandle() will be used. |
IOException |
boolean org.ccnx.ccn.io.CCNFileInputStream.headerRequested | ( | ) | [protected] |
boolean org.ccnx.ccn.io.CCNFileInputStream.hasHeader | ( | ) |
void org.ccnx.ccn.io.CCNFileInputStream.waitForHeader | ( | Long | timeout | ) | throws ContentNotReadyException |
Callers who wish to access the header should call this first; it will wait until the header has been successfully retrieved (if the retrieval has started).
ContentNotReadyException | if we have not requested the header yet. |
Header org.ccnx.ccn.io.CCNFileInputStream.header | ( | ) | throws ContentNotReadyException, ContentGoneException, ErrorStateException |
Accesses the header data if it has been requested.
ContentNotReadyException | if we have not retrieved the header yet, or it hasn't been requested. | |
ContentGoneException | if the header has been deleted. | |
ErrorStateException |
void org.ccnx.ccn.io.CCNFileInputStream.requestHeader | ( | ContentName | baseName, | |
PublisherPublicKeyDigest | publisher | |||
) | throws ContentDecodingException, IOException [protected] |
Request the header in the background.
baseName | name of the content, including the version, from which the header name will be derived. | |
publisher | expected publisher |
IOException | If the header cannot be retrieved. | |
ContentDecodingException | If the header cannot be decoded. |
int org.ccnx.ccn.io.CCNFileInputStream.segmentCount | ( | ) | throws IOException [protected] |
IOException |
Reimplemented from org.ccnx.ccn.io.CCNAbstractInputStream.
void org.ccnx.ccn.io.CCNFileInputStream.seek | ( | long | position | ) | throws IOException |
Seek a stream to a specific byte offset from the start.
Tries to avoid retrieving extra segments.
position |
IOException |
Reimplemented from org.ccnx.ccn.io.CCNAbstractInputStream.
long org.ccnx.ccn.io.CCNFileInputStream.tell | ( | ) | throws IOException |
IOException |
Reimplemented from org.ccnx.ccn.io.CCNAbstractInputStream.
long org.ccnx.ccn.io.CCNFileInputStream.length | ( | ) | throws IOException |
IOException |
Reimplemented from org.ccnx.ccn.io.CCNAbstractInputStream.
void org.ccnx.ccn.io.CCNFileInputStream.newVersionAvailable | ( | CCNNetworkObject<?> | newVersion, | |
boolean | wasSave | |||
) |
Notification when a new version is available of a given object (the object's data and version information will already have been updated to reflect the new version).
newVersion | The newly updated object. | |
wasSave | If true, someone called save() on this particular object, if false, the object received new data from the network. |
Implements org.ccnx.ccn.io.content.UpdateListener.
HeaderObject org.ccnx.ccn.io.CCNFileInputStream._oldHeader = null [protected] |
Temporary backwards-compatibility move.
..