public class ArchiveManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ArchiveManager.ARCHIVE_TYPE |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
METADATA_NAME |
Constructor and Description |
---|
ArchiveManager(int maxHandlers,
long maxCachedData,
long maxArchivedFileSize,
int maxCachedElements,
BucketFactory tempBucketFactory)
Create an ArchiveManager.
|
Modifier and Type | Method and Description |
---|---|
void |
extractToCache(FreenetURI key,
ArchiveManager.ARCHIVE_TYPE archiveType,
Compressor.COMPRESSOR_TYPE ctype,
Bucket data,
ArchiveContext archiveContext,
freenet.client.ArchiveStoreContext ctx,
java.lang.String element,
ArchiveExtractCallback callback,
ClientContext context)
Extract data to cache.
|
Bucket |
getCached(FreenetURI key,
java.lang.String filename)
Get a cached, previously extracted, file from an archive.
|
ArchiveHandler |
makeHandler(FreenetURI key,
ArchiveManager.ARCHIVE_TYPE archiveType,
Compressor.COMPRESSOR_TYPE ctype,
boolean forceRefetch,
boolean persistent)
Create an archive handler.
|
public static final java.lang.String METADATA_NAME
public ArchiveManager(int maxHandlers, long maxCachedData, long maxArchivedFileSize, int maxCachedElements, BucketFactory tempBucketFactory)
maxHandlers
- The maximum number of cached ArchiveHandler's i.e. the
maximum number of containers to track.maxCachedData
- The maximum size of the cache directory, in bytes.maxArchiveSize
- The maximum size of an archive.maxArchivedFileSize
- The maximum extracted size of a single file in any
archive.maxCachedElements
- The maximum number of cached elements (an element is a
file extracted from an archive. It is stored, encrypted and padded, in a single
file.tempBucketFactory
- public ArchiveHandler makeHandler(FreenetURI key, ArchiveManager.ARCHIVE_TYPE archiveType, Compressor.COMPRESSOR_TYPE ctype, boolean forceRefetch, boolean persistent)
key
- The key of the archive that we are extracting data from.archiveType
- The archive type, defined in Metadata.public Bucket getCached(FreenetURI key, java.lang.String filename) throws ArchiveFailureException
key
- The key used to fetch the archive.filename
- The name of the file within the archive.ArchiveFailureException
public void extractToCache(FreenetURI key, ArchiveManager.ARCHIVE_TYPE archiveType, Compressor.COMPRESSOR_TYPE ctype, Bucket data, ArchiveContext archiveContext, freenet.client.ArchiveStoreContext ctx, java.lang.String element, ArchiveExtractCallback callback, ClientContext context) throws ArchiveFailureException, ArchiveRestartException
key
- The key the data was fetched from.archiveType
- The archive type. Must be Metadata.ARCHIVE_ZIP | Metadata.ARCHIVE_TAR.data
- The actual data fetched.archiveContext
- The context for the whole fetch process.ctx
- The ArchiveStoreContext for this key.element
- A particular element that the caller is especially interested in, or null.callback
- A callback to be called if we find that element, or if we don't.ArchiveFailureException
- If we could not extract the data, or it was too big, etc.ArchiveRestartException
ArchiveRestartException
- If the request needs to be restarted because the archive
changed.