Class UnBzip2

  • All Implemented Interfaces:
    AdditionalInformationHandler, BufferSupporter, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, Actor, ErrorHandler, InputConsumer, OutputProducer, Serializable, Comparable

    public class UnBzip2
    extends AbstractSingleDecompress
    Decompresses an archive that was compressed with bzip2. It is assumed, that the file ends with .bz2. If that is not the case, an alternative filename has to be provided.
    The filename of the generated output filename is then broadcasted.

    Input/output:
    - accepts:
       java.lang.String
       java.io.File
    - generates:
       java.lang.String


    Valid options are:

    -D <int> (property: debugLevel)
        The greater the number the more additional info the scheme may output to 
        the console (0 = off).
        default: 0
        minimum: 0
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: UnBzip2
     
    -annotation <adams.core.base.BaseText> (property: annotations)
        The annotations to attach to this actor.
        default: 
     
    -skip (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded 
        as it is.
     
    -stop-flow-on-error (property: stopFlowOnError)
        If set to true, the flow gets stopped in case this actor encounters an error;
         useful for critical actors.
     
    -use-out-dir (property: useAlternativeOutputDir)
        By default the compressed file will be uncompressed at the same location 
        as the archive with the .bz2 extension; use this option to enabled the selection 
        of a different output directory.
     
    -out-dir <adams.core.io.PlaceholderDirectory> (property: alternativeOutputDir)
        The alternative output directory to use.
        default: ${CWD}
     
    -alt-filename <java.lang.String> (property: alternativeFilename)
        The alternative filename to use, instead of the one from the input file 
        with the .bz2 extension removed.
        default: 
     
    -buffer <int> (property: bufferSize)
        The size of the buffer in bytes for the data stream.
        default: 1024
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Constructor Detail

      • UnBzip2

        public UnBzip2()
    • Method Detail

      • useAlternativeOutputDirTipText

        public String useAlternativeOutputDirTipText()
        Returns the tip text for this property.
        Specified by:
        useAlternativeOutputDirTipText in class AbstractSingleDecompress
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • alternativeFilenameTipText

        public String alternativeFilenameTipText()
        Returns the tip text for this property.
        Specified by:
        alternativeFilenameTipText in class AbstractSingleDecompress
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getDefaultExtension

        protected String getDefaultExtension()
        Returns the default extension that the compressed archive has, e.g., ".bz2" for compressed files.
        Specified by:
        getDefaultExtension in class AbstractSingleDecompress
        Returns:
        the extension, including the dot
      • decompress

        protected String decompress​(File inFile,
                                    File outFile)
        Decompresses the archive.
        Specified by:
        decompress in class AbstractSingleDecompress
        Parameters:
        inFile - the compressed archive
        outFile - the decompressed output file
        Returns:
        null if successful, otherwise error message
      • decompress

        protected String decompress​(byte[] inBytes,
                                    gnu.trove.list.TByteList outBytes)
        Decompresses the bytes.
        Specified by:
        decompress in class AbstractSingleDecompress
        Parameters:
        inBytes - the compressed bytes
        outBytes - the decompressed bytes
        Returns:
        null if successful, otherwise error message