|
TrueZIP 6.8.2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.io.samples.CommandLineUtility
de.schlichtherle.io.samples.NZip
public class NZip
A comprehensive command line utility which allows you to work
with entries in all supported archive files using Unix like commands
(cat, cp, rm, mkdir,
rmdir, ls etc.).
Please note that TrueZIP is designed for optimum performance.
However, this utility features some optional archive drivers which
provide additional safety or otherwise unavailable features.
Some of these drivers are not used in their default configuration -
see DefaultArchiveDetector for more
information.
For example, the ZIP drivers used in this utility always check
the CRC-32 values provided in the ZIP file.
In addition, the SFX driver is used which allows you to browse
.exe files if they happen to be SelF eXtracting archives (SFX).
If they are not however, TrueZIP may spend some considerable amount of
time searching for the Central Directory required to be present in ZIP
(and hence SFX) files.
As a conclusion, this utility should not serve as a performance benchmark.
This class is not thread safe.
| Nested Class Summary | |
|---|---|
class |
NZip.IllegalUsageException
|
| Nested classes/interfaces inherited from class de.schlichtherle.io.samples.CommandLineUtility |
|---|
CommandLineUtility.ProgressMonitor |
| Field Summary | |
|---|---|
private static String |
CLASS_NAME
|
private DateFormat |
dateFormat
|
private FieldPosition |
fpos
|
private NumberFormat |
numberFormat
|
private static ResourceBundle |
resources
|
| Fields inherited from class de.schlichtherle.io.samples.CommandLineUtility |
|---|
err, out, progressMonitor |
| Constructor Summary | |
|---|---|
NZip()
|
|
NZip(OutputStream out,
OutputStream err,
boolean autoFlush)
|
|
| Method Summary | |
|---|---|
private void |
align(StringBuffer buf,
long number,
int spacing)
|
private void |
cat(String[] args)
|
private void |
cpOrMv(String[] args,
boolean mv)
|
protected DefaultArchiveDetector |
createDefaultArchiveDetector()
May be overridden by subclasses to create the ArchiveDetector
which shall be used as the
default archive detector while
a command is running. |
protected DefaultArchiveDetector |
createDefaultArchiveDetector(String charset)
May be overridden by subclasses to create the ArchiveDetector
which returns ArchiveDrivers
which should use the specified charset if supported. |
private boolean |
exists(String[] args)
|
private boolean |
isArchive(String[] args)
|
private boolean |
isDirectory(String[] args)
|
private boolean |
isFile(String[] args)
|
private boolean |
length(String[] args)
|
private void |
ls(File file,
String path,
boolean detailed)
|
private void |
ls(File file,
String path,
boolean detailed,
boolean recursive)
Lists the given file with the given display path. |
private void |
ls(String[] args,
boolean detailed,
boolean recursive)
|
private static String[] |
lshift(String[] args)
|
private static String[] |
lshift(String[] args,
int num)
|
static void |
main(String[] args)
Equivalent to System.exit(new NZip().run(args));. |
private void |
mkdir(String[] args,
boolean recursive)
|
private void |
rm(String[] args,
boolean recursive)
|
boolean |
runWithException(String[] args)
Runs this command line utility. |
private void |
touch(String[] args)
|
| Methods inherited from class de.schlichtherle.io.samples.CommandLineUtility |
|---|
run |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final String CLASS_NAME
private static final ResourceBundle resources
private final NumberFormat numberFormat
private final DateFormat dateFormat
private final FieldPosition fpos
| Constructor Detail |
|---|
public NZip()
public NZip(OutputStream out,
OutputStream err,
boolean autoFlush)
| Method Detail |
|---|
protected DefaultArchiveDetector createDefaultArchiveDetector()
ArchiveDetector
which shall be used as the
default archive detector while
a command is running.
The ArchiveDrivers returned
by the archive detector should use their default charsets.
Note that the archive detector which is returned by the implementation in this class uses some archive drivers which may be pretty slow due to some extra compatibility tests which they perform on every archive.
protected DefaultArchiveDetector createDefaultArchiveDetector(String charset)
ArchiveDetector
which returns ArchiveDrivers
which should use the specified charset if supported.
This is used by selected commands in this class.
Note that the archive detector which is returned by the implementation in this class uses some archive drivers which may be pretty slow due to some extra compatibility tests which they perform on every archive.
public static void main(String[] args)
System.exit(new NZip().run(args));.
public boolean runWithException(String[] args)
throws NZip.IllegalUsageException,
IOException
runWithException in class CommandLineUtilityargs - A non-empty array of Unix-like commands and optional
parameters.
false iff the command is a test which fails,
true otherwise.
NZip.IllegalUsageException - If args does not contain
correct commands or parameters.
IOException - On any I/O related exception.private static final String[] lshift(String[] args)
private static String[] lshift(String[] args,
int num)
private void ls(String[] args,
boolean detailed,
boolean recursive)
throws IOException
IOException
private void ls(File file,
String path,
boolean detailed,
boolean recursive)
throws IOException
IOException
private void ls(File file,
String path,
boolean detailed)
private void align(StringBuffer buf,
long number,
int spacing)
private void cat(String[] args)
throws IOException
IOException
private void cpOrMv(String[] args,
boolean mv)
throws IOException
IOException
private void touch(String[] args)
throws IOException
IOException
private void mkdir(String[] args,
boolean recursive)
throws IOException
IOException
private void rm(String[] args,
boolean recursive)
throws IOException
IOExceptionprivate boolean isArchive(String[] args)
private boolean isDirectory(String[] args)
private boolean isFile(String[] args)
private boolean exists(String[] args)
private boolean length(String[] args)
|
TrueZIP 6.8.2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||