Class Lister


  • public final class Lister
    extends java.lang.Object
    Simple 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
    • Constructor Summary

      Constructors 
      Constructor Description
      Lister()
      Deprecated.
      No replacement.
      Lister​(boolean quiet, java.lang.String... args)  
    • 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>
      T
      createArchiveInputStream​(java.lang.String[] args, java.io.InputStream inputStream)  
      private static java.lang.String detectFormat​(java.nio.file.Path file)  
      (package private) void go()  
      private void list​(java.nio.file.Path file, java.lang.String... args)  
      private void list7z​(java.nio.file.Path file)  
      private void listStream​(java.nio.file.Path file, java.lang.String[] args)  
      private void listZipUsingTarFile​(java.nio.file.Path file)  
      private void listZipUsingZipFile​(java.nio.file.Path file)  
      static void main​(java.lang.String... args)
      Runs this class from the command line.
      private void println​(java.lang.String line)  
      private void println​(ArchiveEntry entry)  
      private static void usage()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • quiet

        private final boolean quiet
      • args

        private final java.lang.String[] args
    • Constructor Detail

      • Lister

        @Deprecated
        public Lister()
        Deprecated.
        No replacement.
        Constructs a new instance.
      • Lister

        Lister​(boolean quiet,
               java.lang.String... args)
    • Method Detail

      • detectFormat

        private static java.lang.String detectFormat​(java.nio.file.Path file)
                                              throws ArchiveException,
                                                     java.io.IOException
        Throws:
        ArchiveException
        java.io.IOException
      • main

        public static void main​(java.lang.String... args)
                         throws ArchiveException,
                                java.io.IOException
        Runs 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()
      • list

        private void list​(java.nio.file.Path file,
                          java.lang.String... args)
                   throws ArchiveException,
                          java.io.IOException
        Throws:
        ArchiveException
        java.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:
        ArchiveException
        java.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​(java.lang.String line)