- java.lang.Object
-
- kala.compress.archivers.examples.Lister
-
public final class Lister extends java.lang.ObjectSimple command line application that lists the contents of an archive.The name of the archive must be given as a command line argument.
The optional second argument defines the archive type, in case the format is not recognized.
- Since:
- 1.1
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String[]argsprivate static ArchiveStreamFactoryFACTORYprivate booleanquiet
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static <T extends ArchiveInputStream<? extends E>,E extends ArchiveEntry>
TcreateArchiveInputStream(java.lang.String[] args, java.io.InputStream inputStream)private static java.lang.StringdetectFormat(java.nio.file.Path file)(package private) voidgo()private voidlist(java.nio.file.Path file, java.lang.String... args)private voidlist7z(java.nio.file.Path file)private voidlistStream(java.nio.file.Path file, java.lang.String[] args)private voidlistZipUsingTarFile(java.nio.file.Path file)private voidlistZipUsingZipFile(java.nio.file.Path file)static voidmain(java.lang.String... args)Runs this class from the command line.private voidprintln(java.lang.String line)private voidprintln(ArchiveEntry entry)private static voidusage()
-
-
-
Field Detail
-
FACTORY
private static final ArchiveStreamFactory FACTORY
-
quiet
private final boolean quiet
-
args
private final java.lang.String[] args
-
-
Method Detail
-
createArchiveInputStream
private static <T extends ArchiveInputStream<? extends E>,E extends ArchiveEntry> T createArchiveInputStream(java.lang.String[] args, java.io.InputStream inputStream) throws ArchiveException
- Throws:
ArchiveException
-
detectFormat
private static java.lang.String detectFormat(java.nio.file.Path file) throws java.io.IOException- Throws:
java.io.IOException
-
main
public static void main(java.lang.String... args) throws ArchiveException, java.io.IOExceptionRuns this class from the command line.The name of the archive must be given as a command line argument.
The optional second argument defines the archive type, in case the format is not recognized.
- Parameters:
args- name of the archive and optional argument archive type.- Throws:
ArchiveException- Archiver related Exception.java.io.IOException- an I/O exception.
-
usage
private static void usage()
-
go
void go() throws ArchiveException, java.io.IOException
- Throws:
ArchiveExceptionjava.io.IOException
-
list
private void list(java.nio.file.Path file, java.lang.String... args) throws ArchiveException, java.io.IOException- Throws:
ArchiveExceptionjava.io.IOException
-
list7z
private void list7z(java.nio.file.Path file) throws java.io.IOException- Throws:
java.io.IOException
-
listStream
private void listStream(java.nio.file.Path file, java.lang.String[] args) throws ArchiveException, java.io.IOException- Throws:
ArchiveExceptionjava.io.IOException
-
listZipUsingTarFile
private void listZipUsingTarFile(java.nio.file.Path file) throws java.io.IOException- Throws:
java.io.IOException
-
listZipUsingZipFile
private void listZipUsingZipFile(java.nio.file.Path file) throws java.io.IOException- Throws:
java.io.IOException
-
println
private void println(ArchiveEntry entry)
-
println
private void println(java.lang.String line)
-
-