Class JARTool


  • public class JARTool
    extends java.lang.Object
    JAR toolbox
    This class only provides static variables and methods
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String content​(byte[] data)
      Get JAR content
      static java.lang.String content​(java.io.File file)
      Get JAR content
      static java.lang.String content​(java.io.InputStream in)
      Get JAR content
      static java.lang.String content​(java.lang.String path)
      Get JAR content
      static void create​(java.io.File file, java.lang.String dir, java.lang.String[] pkgs)
      Create jar from directory
      static void create​(java.io.OutputStream out, java.lang.String dir, java.lang.String[] incs)
      Create jar from directory
      static byte[] create​(java.lang.String dir)
      Create jar from directory
      static byte[] create​(java.lang.String dir, java.lang.String[] pkgs)
      Create jar from directory
      static void create​(java.lang.String path, java.lang.String dir, java.lang.String[] pkgs)
      Create jar from directory
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • content

        public static java.lang.String content​(java.lang.String path)
                                        throws java.lang.Exception
        Get JAR content
        Parameters:
        path - JAR file path
        Throws:
        java.lang.Exception
      • content

        public static java.lang.String content​(java.io.File file)
                                        throws java.lang.Exception
        Get JAR content
        Parameters:
        file - JAR file
        Throws:
        java.lang.Exception
      • content

        public static java.lang.String content​(byte[] data)
                                        throws java.lang.Exception
        Get JAR content
        Parameters:
        data - JAR data
        Throws:
        java.lang.Exception
      • content

        public static java.lang.String content​(java.io.InputStream in)
                                        throws java.lang.Exception
        Get JAR content
        Parameters:
        in - JAR input stream
        Throws:
        java.lang.Exception
      • create

        public static byte[] create​(java.lang.String dir)
                             throws java.lang.Exception
        Create jar from directory
        Parameters:
        dir - Directory
        Throws:
        java.lang.Exception
      • create

        public static byte[] create​(java.lang.String dir,
                                    java.lang.String[] pkgs)
                             throws java.lang.Exception
        Create jar from directory
        Parameters:
        dir - Directory
        pkgs - Optional list of packages to include (defaults to all files/directories)
        Throws:
        java.lang.Exception
      • create

        public static void create​(java.lang.String path,
                                  java.lang.String dir,
                                  java.lang.String[] pkgs)
                           throws java.lang.Exception
        Create jar from directory
        Parameters:
        path - JAR file path
        dir - Directory
        pkgs - Optional list of packages to include (defaults to all files/directories)
        Throws:
        java.lang.Exception
      • create

        public static void create​(java.io.File file,
                                  java.lang.String dir,
                                  java.lang.String[] pkgs)
                           throws java.lang.Exception
        Create jar from directory
        Parameters:
        file - JAR file
        dir - Directory
        pkgs - Optional list of packages to include (defaults to all files/directories)
        Throws:
        java.lang.Exception
      • create

        public static void create​(java.io.OutputStream out,
                                  java.lang.String dir,
                                  java.lang.String[] incs)
                           throws java.lang.Exception
        Create jar from directory
        Parameters:
        out - Output stream
        dir - Directory
        incs - Optional list of directories/packages or files to include (defaults to all files/directories)
        Throws:
        java.lang.Exception