Class Zstd

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

    public class Zstd
    extends AbstractSingleCompress
    Creates a Zstd archive from a single file. Outputs the filename of the Zstd file generated. Optionally, the original input file can be deleted.

    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: Zstd
     
    -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.
     
    -remove (property: removeInputFile)
        If set to true, then the original input file will be deleted after a successful 
        compression.
     
    -output <adams.core.io.PlaceholderFile> (property: output)
        The Zstd (7zip) file to create; if pointing to a directory, then the output 
        filename is based on the file that is being compressed and the '.7z' extension 
        added.
        default: ${CWD}
     
    -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

      • Zstd

        public Zstd()
    • Method Detail

      • outputTipText

        public String outputTipText()
        Returns the tip text for this property.
        Specified by:
        outputTipText in class AbstractSingleCompress
        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., ".7z" for compressed files.
        Specified by:
        getDefaultExtension in class AbstractSingleCompress
        Returns:
        the extension, including the dot
      • compress

        protected String compress​(File inFile,
                                  File outFile)
        Compresses the file.
        Specified by:
        compress in class AbstractSingleCompress
        Parameters:
        inFile - the uncompressed input file
        outFile - the compressed output file
        Returns:
        null if successfully compressed, otherwise error message
      • compress

        protected String compress​(byte[] inBytes,
                                  gnu.trove.list.TByteList outBytes)
        Compresses the bytes.
        Specified by:
        compress in class AbstractSingleCompress
        Parameters:
        inBytes - the uncompressed bytes
        outBytes - the compressed bytes
        Returns:
        null if successfully compressed, otherwise error message