Interface FilePacker

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
Bzip2FilePacker, GzipFilePacker, TarFilePacker, ZipFilePacker

public interface FilePacker extends AutoCloseable
This interface should be implemented by classes that can pack files and directories from BASE file system. The implementing class must also have a public no-argument constructor. The implementing classes are used by the PackedFileExporter plug-in. Each class should be registered in a PluginConfiguration for the PackedFileExporter.
Version:
2.4
Author:
Martin, Nicklas
Last modified
$Date: 2006-11-30 10:50:05 +0100 (Thu, 30 Nov 2006) $
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    End the packing and close.
    Get a short description of this file format that is suitable for display in selection list boxes.
    Gets the extension that files, packed with this tool, should have, for example, zip or tar.gz Don't include the first dot!
    Gets the MIME type to give compressed files from this packer
    The default implementation return a parameter asking for a password.
    void
    pack(String entryName, InputStream in, long size, long lastModified)
    Compress the uncompressed input stream to an entry with the given name into the outputstream.
    void
    The output stream that the compressed files should be written to.
    default void
    setPassword(String password)
    Set the password to use for encrypting the archive.
    default boolean
    Does the packer support encryption or not?
  • Method Details

    • getDescription

      String getDescription()
      Get a short description of this file format that is suitable for display in selection list boxes.
    • getFileExtension

      String getFileExtension()
      Gets the extension that files, packed with this tool, should have, for example, zip or tar.gz Don't include the first dot!
      Returns:
      A String with the file extension excluding the dot
    • getMimeType

      String getMimeType()
      Gets the MIME type to give compressed files from this packer
      Returns:
      The MIME type of the compressed file format
    • supportsEncryption

      default boolean supportsEncryption()
      Does the packer support encryption or not? The default implementation return false.
      Since:
      3.19.5
    • getPasswordParameter

      default PluginParameter<String> getPasswordParameter()
      The default implementation return a parameter asking for a password. The implementing class may create another parameter as long as it is named "password". This method is only called if the implementation supports encryption.
      Since:
      3.19.5
    • setPassword

      default void setPassword(String password)
      Set the password to use for encrypting the archive. This method is only called if the implementation supports encryption and the user has entered a password.
      Since:
      3.19.5
    • setOutputStream

      void setOutputStream(OutputStream out) throws IOException
      The output stream that the compressed files should be written to.
      Parameters:
      out - The output stream to write to
      Throws:
      IOException - If there is an error setting the output stream
    • pack

      void pack(String entryName, InputStream in, long size, long lastModified) throws IOException
      Compress the uncompressed input stream to an entry with the given name into the outputstream.
      Parameters:
      entryName - The name of the packed resource, including path information
      in - The input stream to read uncompressed data from, or null if the entry represents a directory
      size - The number of bytes of uncompressed data
      lastModified - The time the contents was last modified, or 0 if not known
      Throws:
      IOException - If there are any errors when reading or writing
    • close

      void close() throws IOException
      End the packing and close. The plug-in should close any open resources, including the output stream set by the setOutputStream(OutputStream) method, and cleanup temporary objects.
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException - If there are any errors