ArchiverNULL¶
-
public abstract class
ArchiverNULL
implements Archiver¶ An ArchiverNULL is a null packaging device that provides some useful method for the sub-class which enhance code design and ease to read.
- Pre-error Handling of compress,list and extract
Creation Date: 13/11/2006
Author: Twinsen Tsang
Methods¶
compress¶
-
public boolean
compress
(File src, File dest, boolean includeItself)¶ The NULL archiver validates all fields in the parameters and return false in the end.
Parameters: - src – The source of the file(s) to be archive.
- dest – The destination of the arhived file.
- includeItself – the source directory includes in the archive if it is true, vice versa.
Throws: - IOException – if any kind of I/O Erros
Returns: true if the operations run successfully.
See also:
hk.hku.cecid.edi.sfrm.archive.Archiver.compress(File,File,boolean)
extract¶
-
public boolean
extract
(File archive, File dest)¶ The NULL archiver validates all fields in the parameters and return false in the end. If the destination directory does not exist, the NULL archiver will create one for you.
Parameters: - archive – The archive to be extract.
- dest – The destination directory extract to.
Throws: - IOException – Any kind of I/O Errors.
- IllegalArgumentException – If the
dest
is not a directory.
Returns: true if the operations run successfully.
getBaseArchivingDirectory¶
listAsFile¶
listAsFilename¶
listFilesToArchive¶
-
protected Iterator
listFilesToArchive
(File src)¶ List out all files that need to be archive in a
compress(File,File,boolean)
call. NOTE: This method should only be used inside thecompress
method.Parameters: - src – The source of the file(s) to be archive.
Returns: An iterator whichs contains a list of files object to archive.