org.at4j.tar
Class TarExtractSpecification

java.lang.Object
  extended by org.at4j.tar.TarExtractSpecification

public class TarExtractSpecification
extends Object

This specification object contains configuration for an extraction operation by the TarExtractor.

When this object is instantiated, it contains the default extraction settings:

Since:
1.0
Author:
Karl Gustafsson

Constructor Summary
TarExtractSpecification()
           
 
Method Summary
 TarEntryExtractionStrategy getEntryExtractionStrategy()
          Get the strategy object used for extracting entries.
 Charset getFileNameCharset()
          Get the charset used for decoding file names in the Tar file.
 Filter<? super TarEntryHeaderData> getFilter()
          Get the filter that is used to decide which of the Tar entries to extract.
 OverwriteStrategy getOverwriteStrategy()
          Are existing entities overwritten with entries from the archive?
 TarExtractSpecification setEntryExtractionStrategy(TarEntryExtractionStrategy strat)
          Set the strategy object used for extracting entries.
 TarExtractSpecification setFileNameCharset(Charset cs)
          Set the charset to use for decoding file names in the Tar file (and the names of other entry types as well).
 TarExtractSpecification setFilter(Filter<? super TarEntryHeaderData> f)
          Set the filter to use to decide which entries to extract.
 TarExtractSpecification setOverwriteStrategy(OverwriteStrategy os)
          If there already are an entity (file or directory) at the location where an entry should be extracted, should the old entity be overwritten? Should a warning message be printed?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TarExtractSpecification

public TarExtractSpecification()
Method Detail

setFilter

public TarExtractSpecification setFilter(Filter<? super TarEntryHeaderData> f)
Set the filter to use to decide which entries to extract. Set this to null to extract all entries.

All entries in the Tar file are evaluated against this filter. If it matches an entry but not its parent directory, the parent directory is extracted anyway.

Parameters:
f - The filter that is used to decide which entries to extract. Any ArchiveEntryFilter works here.

getFilter

public Filter<? super TarEntryHeaderData> getFilter()
Get the filter that is used to decide which of the Tar entries to extract. If this is null, all entries are extracted.

Returns:
The filter or null.

setEntryExtractionStrategy

public TarExtractSpecification setEntryExtractionStrategy(TarEntryExtractionStrategy strat)
Set the strategy object used for extracting entries.

Parameters:
strat - The strategy object.

getEntryExtractionStrategy

public TarEntryExtractionStrategy getEntryExtractionStrategy()
Get the strategy object used for extracting entries.

Returns:
The strategy object used for extracting entries.

setFileNameCharset

public TarExtractSpecification setFileNameCharset(Charset cs)
Set the charset to use for decoding file names in the Tar file (and the names of other entry types as well). By default, the platform's default charset is used.

Parameters:
cs - The charset.

getFileNameCharset

public Charset getFileNameCharset()
Get the charset used for decoding file names in the Tar file.

Returns:
The charset.

setOverwriteStrategy

public TarExtractSpecification setOverwriteStrategy(OverwriteStrategy os)
If there already are an entity (file or directory) at the location where an entry should be extracted, should the old entity be overwritten? Should a warning message be printed?

Non-empty directories cannot be overwritten. If the Tar extractor attempts to do so, an TarFileParseException is thrown.

Parameters:
os - The strategy to use for overwriting entities.
Returns:
this

getOverwriteStrategy

public OverwriteStrategy getOverwriteStrategy()
Are existing entities overwritten with entries from the archive?

Returns:
The overwrite strategy
See Also:
setOverwriteStrategy(OverwriteStrategy)