Class JAR


  • public final class JAR
    extends java.lang.Object
    Basic functions for working with JAR files in test cases.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private JAR()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void close​(java.util.jar.JarFile jar)
      Close a JAR file.
      static void create​(java.io.File srcDir, java.io.File jarFile)
      Create a JAR file out of the contents of a specific directory (recursively)
      private static void packDir​(java.io.File baseDir, java.io.File srcDir, java.util.jar.JarOutputStream jarout)  
      static void unpack​(java.io.File jarFile, java.io.File destDir)
      Unpack JAR file into destination directory.
      private static void unpack​(java.util.jar.JarFile jar, java.util.jar.JarEntry entry, java.io.File destFile)  
      • Methods inherited from class java.lang.Object

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

      • JAR

        private JAR()
    • Method Detail

      • unpack

        public static void unpack​(java.io.File jarFile,
                                  java.io.File destDir)
                           throws java.io.IOException
        Unpack JAR file into destination directory.
        Parameters:
        jarFile - the jar file to unpack
        destDir - the destination directory to unpack into
        Throws:
        java.io.IOException - if unable to unpack jar file.
      • unpack

        private static void unpack​(java.util.jar.JarFile jar,
                                   java.util.jar.JarEntry entry,
                                   java.io.File destFile)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • close

        public static void close​(java.util.jar.JarFile jar)
        Close a JAR file.
        Parameters:
        jar - the JarFile to close
      • create

        public static void create​(java.io.File srcDir,
                                  java.io.File jarFile)
                           throws java.io.IOException
        Create a JAR file out of the contents of a specific directory (recursively)
        Parameters:
        srcDir - the source directory
        jarFile - the destination jar file to create
        Throws:
        java.io.IOException - if unable to create the jar file, or read the source directory
      • packDir

        private static void packDir​(java.io.File baseDir,
                                    java.io.File srcDir,
                                    java.util.jar.JarOutputStream jarout)
                             throws java.io.IOException
        Throws:
        java.io.IOException