Package adams.core.io
Class TarArchiveManager
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.core.io.TarArchiveManager
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,ArchiveManager,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,SizeOfHandler,Serializable
public class TarArchiveManager extends AbstractOptionHandler implements ArchiveManager
Manages tar files.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intm_BufferSizethe buffer size to use.protected TarUtils.Compressionm_Compressionthe compression to use.protected FileOutputStreamm_FileOutthe file output stream for the tar archive.protected org.apache.commons.compress.archivers.tar.TarArchiveOutputStreamm_TarOutthe tar archive stream.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description TarArchiveManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringadd(byte[] data, String name)Adds the data to the archive.Stringadd(PlaceholderFile data, String name)Adds the file to the archive.Stringadd(InputStream data, String name)Adds the data from the input stream to the archive.StringbufferSizeTipText()Returns the tip text for this property.Stringclose()Finalizes the archive.StringcompressionTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.intgetBufferSize()Returns the buffer size for the stream.TarUtils.CompressiongetCompression()Returns the compression to use.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.StringglobalInfo()Returns a string describing the object.Stringinitialize(PlaceholderFile output)Initializes the archive.voidsetBufferSize(int value)Sets the buffer size for the stream.voidsetCompression(TarUtils.Compression value)Sets the compression to use.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_Compression
protected TarUtils.Compression m_Compression
the compression to use.
-
m_BufferSize
protected int m_BufferSize
the buffer size to use.
-
m_TarOut
protected transient org.apache.commons.compress.archivers.tar.TarArchiveOutputStream m_TarOut
the tar archive stream.
-
m_FileOut
protected transient FileOutputStream m_FileOut
the file output stream for the tar archive.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setCompression
public void setCompression(TarUtils.Compression value)
Sets the compression to use. IfTarUtils.Compression.AUTOthen compression gets determined based on file extension.- Parameters:
value- the compression to use
-
getCompression
public TarUtils.Compression getCompression()
Returns the compression to use. IfTarUtils.Compression.AUTOthen compression gets determined based on file extension.- Returns:
- the compression to use
-
compressionTipText
public String compressionTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setBufferSize
public void setBufferSize(int value)
Sets the buffer size for the stream.- Parameters:
value- the size in bytes
-
getBufferSize
public int getBufferSize()
Returns the buffer size for the stream.- Returns:
- the size in bytes
-
bufferSizeTipText
public String bufferSizeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Returns:
- null if no info available, otherwise short string
-
initialize
public String initialize(PlaceholderFile output)
Initializes the archive.- Specified by:
initializein interfaceArchiveManager- Parameters:
output- the file name for the archive- Returns:
- null if successful, otherwise error message
-
add
public String add(PlaceholderFile data, String name)
Adds the file to the archive.- Specified by:
addin interfaceArchiveManager- Parameters:
data- the file to addname- the name for the file in the archive- Returns:
- null if successful, otherwise error message
-
add
public String add(InputStream data, String name)
Adds the data from the input stream to the archive. Caller needs to close input stream.- Specified by:
addin interfaceArchiveManager- Parameters:
data- the data to addname- the name for the data in the archive- Returns:
- null if successful, otherwise error message
-
add
public String add(byte[] data, String name)
Adds the data to the archive.- Specified by:
addin interfaceArchiveManager- Parameters:
data- the data to addname- the name for the data in the archive- Returns:
- null if successful, otherwise error message
-
close
public String close()
Finalizes the archive.- Specified by:
closein interfaceArchiveManager- Returns:
- null if successful, otherwise error message
-
-