public class ArchiveFilter extends java.lang.Object implements TransferFilter
Modifier and Type | Field and Description |
---|---|
static int |
BUFFERSIZE |
protected boolean |
cancelled |
protected java.lang.String |
comment |
protected java.lang.String |
countrenamed |
java.lang.String |
ENTRIES_RENAMED |
java.lang.String |
ENTRIES_SKIPPED |
protected java.lang.String |
extension |
protected java.lang.String |
filesskipped |
protected java.util.List |
filesSkipped |
protected java.lang.String |
fullname |
protected java.lang.String |
fullpathEnabled |
protected java.lang.String |
hiddenEntry |
protected java.lang.String |
identifier |
protected int |
level |
protected long |
maxsize |
protected java.lang.String |
preserveLastModified |
protected java.util.Properties |
props |
protected java.lang.String |
template |
Constructor and Description |
---|
ArchiveFilter(Conf cnf)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addFile(java.io.File file,
java.util.zip.ZipOutputStream zos,
byte[] buffer)
Add file to compress.
|
protected void |
addFolder(java.util.zip.ZipOutputStream zos,
java.io.File folder,
java.io.File rootFolder,
byte[] buffer,
long level,
long depth)
Compress folder recursively.
|
void |
cancel()
Cancel archive creation.
|
void |
clean()
Delete temporary ZIP archive.
|
java.lang.Object |
execute(java.lang.Object input)
Execute the Filter such as file content checking or modification.
|
void |
init(TransferController tc,
java.lang.String id)
Initialize Filter such as loading configuration file.
|
protected boolean |
isAllowed(java.io.File file)
Check if file is allowed (blacklist, maxsize ...)
|
protected void |
loadParameters()
Load Filter parameters.
|
protected void |
notifyOnComplete(java.io.File output,
java.lang.String txt)
Notify Filter listeners about complete.
|
protected void |
notifyOnFail(ClientException e)
Notify Filter listeners about failure.
|
protected void |
notifyOnStarted(java.io.File input,
java.lang.String txt)
Notify Filter listeners about filter status = started.
|
protected void |
notifyOnStarting(java.lang.Object input,
java.lang.String txt)
Notify Filter listeners about filter status = starting.
|
protected java.io.File |
processCompress(java.util.List list)
Compress files and folders selected.
|
protected java.lang.String |
serializeList(java.util.List list)
Serialize list of File
|
public static int BUFFERSIZE
public java.lang.String ENTRIES_RENAMED
public java.lang.String ENTRIES_SKIPPED
protected java.lang.String identifier
protected java.util.Properties props
protected int level
protected long maxsize
protected java.lang.String comment
protected java.lang.String extension
protected java.lang.String fullname
protected java.lang.String template
protected java.lang.String countrenamed
protected java.lang.String filesskipped
protected java.lang.String hiddenEntry
protected java.lang.String preserveLastModified
protected java.lang.String fullpathEnabled
protected java.util.List filesSkipped
protected boolean cancelled
public ArchiveFilter(Conf cnf)
cnf
- public void init(TransferController tc, java.lang.String id) throws ClientException
TransferFilter
init
in interface TransferFilter
id
- identifierClientException
protected void loadParameters()
public java.lang.Object execute(java.lang.Object input) throws ClientException
TransferFilter
execute
in interface TransferFilter
ClientException
public void clean()
clean
in interface TransferFilter
protected java.io.File processCompress(java.util.List list) throws ClientException
list
- ClientException
protected void addFile(java.io.File file, java.util.zip.ZipOutputStream zos, byte[] buffer) throws java.io.IOException
file
- zos
- buffer
- java.io.IOException
protected void addFolder(java.util.zip.ZipOutputStream zos, java.io.File folder, java.io.File rootFolder, byte[] buffer, long level, long depth) throws java.io.IOException
zos
- ZipOutputStreamfolder
- FilerootFolder
- Filebuffer
- byte[]level
- depth
- java.io.IOException
public void cancel()
protected void notifyOnStarting(java.lang.Object input, java.lang.String txt)
input
- txt
- protected void notifyOnStarted(java.io.File input, java.lang.String txt)
input
- txt
- protected void notifyOnComplete(java.io.File output, java.lang.String txt)
output
- txt
- protected void notifyOnFail(ClientException e)
output
- txt
- protected boolean isAllowed(java.io.File file) throws java.io.IOException
file
- java.io.IOException
protected java.lang.String serializeList(java.util.List list)
list
-