Package net.sf.basedb.plugins
Class Bzip2FileUnpacker
- java.lang.Object
-
- net.sf.basedb.core.plugin.AbstractPlugin
-
- net.sf.basedb.util.zip.AbstractFileUnpacker
-
- net.sf.basedb.plugins.Bzip2FileUnpacker
-
- All Implemented Interfaces:
InteractivePlugin
,Plugin
,SignalTarget
,FileUnpacker
public class Bzip2FileUnpacker extends AbstractFileUnpacker
A plugin for unpacking a bzip2 compressed file to the BASE file system.- Since:
- 3.2
- Author:
- nicklas
- Last modified
- $Date$
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sf.basedb.core.plugin.Plugin
Plugin.MainType
-
-
Field Summary
Fields Modifier and Type Field Description private static Set<String>
extensions
private static Set<String>
mimeTypes
-
Fields inherited from class net.sf.basedb.util.zip.AbstractFileUnpacker
OVERWRITE, UNPACK_DIRECTORY, ZIP_FILE
-
Fields inherited from class net.sf.basedb.core.plugin.AbstractPlugin
annotationSection, configuration, COPY_ANNOTATIONS, job, OVERWRITE_ANNOTATIONS, sc
-
-
Constructor Summary
Constructors Constructor Description Bzip2FileUnpacker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
getExtensions()
Return a set containing the strings [ bz2 ].String
getFormatName()
Get the name of the compressed file format this unpacker supports.Set<String>
getMimeTypes()
Return a set containing the strings [ application/x-bzip2 ].int
unpack(DbControl dc, Directory rootDir, InputStream in, File sourceFile, boolean overwrite, AbsoluteProgressReporter progress)
Unpack the given input stream into a BASE directory.-
Methods inherited from class net.sf.basedb.util.zip.AbstractFileUnpacker
configure, getCurrentDirectory, getCurrentFile, getDirectoryParameter, getGuiContexts, getMainType, getOverwrite, getOverwriteParameter, getPermissions, getRequestInformation, getSignalHandler, getUnpackDirectory, getZipFile, getZipFileParameter, isInContext, requiresConfiguration, run, supportsConfigurations
-
Methods inherited from class net.sf.basedb.core.plugin.AbstractPlugin
cloneParameterWithDefaultValue, closeLogFile, createLogFile, done, getCopyAnnotationsParmeter, getCurrentConfiguration, getCurrentJob, getJobOrConfigurationValue, getOverwriteAnnotationsParameters, init, log, log, storeValue, storeValue, storeValues, validateRequestParameters
-
-
-
-
Method Detail
-
getFormatName
public String getFormatName()
Description copied from interface:FileUnpacker
Get the name of the compressed file format this unpacker supports. For example: ZIP files
-
getExtensions
public Set<String> getExtensions()
Return a set containing the strings [ bz2 ].- Returns:
- A set containing file extensions (do not inlcude the dot)
-
getMimeTypes
public Set<String> getMimeTypes()
Return a set containing the strings [ application/x-bzip2 ].- Returns:
- A set containing MIME types
-
unpack
public int unpack(DbControl dc, Directory rootDir, InputStream in, File sourceFile, boolean overwrite, AbsoluteProgressReporter progress) throws IOException
Description copied from interface:FileUnpacker
Unpack the given input stream into a BASE directory. If a source file is given it can be used as a template for setting certain properties on the unpcked files. SeePackUtil.copyProperties(File, File)
.- Parameters:
dc
- The DbControl to use for database accessrootDir
- The directory to unpack the files toin
- The input stream containing the packed datasourceFile
- The source packed file that the input stream is coming from or null if not knownoverwrite
- If existing files should be overwritten or ignoredprogress
- A optional progress reporter which expects the number of compressed bytes that has been uncompressed- Returns:
- The number of unpacked files
- Throws:
IOException
- If there is an error reading the input stream
-
-