Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.util.file
Class JarUtils

    java.lang.Object
      org.jboss.util.file.JarUtils

public final class JarUtils
extends Object

A utility class for dealing with Jar files.

Version:
  $Revision: 1.8 $
Author:
  Scott.Stark@jboss.org

Method Summary
`static URL` | `extractNestedJar(URL jarURL, File dest)` Given a URL check if its a jar url(jar:!/archive) and if it is, extract the archive entry into the given dest directory and return a file URL to its location.
`static void` | `jar(OutputStream out, File src)` This function will create a Jar archive containing the src file/directory.
`static void` | `jar(OutputStream out, File[] src)` This function will create a Jar archive containing the src file/directory.
`static void` | `jar(OutputStream out, File[] src, FileFilter filter)` This function will create a Jar archive containing the src file/directory.
`static void` | `jar(OutputStream out, File[] src, FileFilter filter, String prefix, Manifest man)` This function will create a Jar archive containing the src file/directory.
`static void` | `main(String[] args)` A simple jar-like tool used for testing.
`static void` | `unjar(InputStream in, File dest)` Dump the contents of a JarArchive to the dpecified destination.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### jar

    public static void jar(OutputStream out,
                           File src)
                    throws IOException

  This function will create a Jar archive containing the src file/directory. The archive will be written to the specified OutputStream.

  This is a shortcut for
  `jar(out, new File[] { src }, null, null, null);`

  Parameters:
    `out` - The output stream to which the generated Jar archive is written.
    `src` - The file or directory to jar up. Directories will be processed recursively.
  Throws:
    `IOException`

### jar

    public static void jar(OutputStream out,
                           File[] src)
                    throws IOException

  This function will create a Jar archive containing the src file/directory. The archive will be written to the specified OutputStream.

  This is a shortcut for
  `jar(out, src, null, null, null);`

  Parameters:
    `out` - The output stream to which the generated Jar archive is written.
    `src` - The file or directory to jar up. Directories will be processed recursively.
  Throws:
    `IOException`

### jar

    public static void jar(OutputStream out,
                           File[] src,
                           FileFilter filter)
                    throws IOException

  This function will create a Jar archive containing the src file/directory. The archive will be written to the specified OutputStream. Directories are processed recursively, applying the specified filter if it exists.

  This is a shortcut for
  `jar(out, src, filter, null, null);`

  Parameters:
    `out` - The output stream to which the generated Jar archive is written.
    `src` - The file or directory to jar up. Directories will be processed recursively.
    `filter` - The filter to use while processing directories. Only those files matching will be included in the jar archive. If null, then all files are included.
  Throws:
    `IOException`

### jar

    public static void jar(OutputStream out,
                           File[] src,
                           FileFilter filter,
                           String prefix,
                           Manifest man)
                    throws IOException

  This function will create a Jar archive containing the src file/directory. The archive will be written to the specified OutputStream. Directories are processed recursively, applying the specified filter if it exists.

  Parameters:
    `out` - The output stream to which the generated Jar archive is written.
    `src` - The file or directory to jar up. Directories will be processed recursively.
    `filter` - The filter to use while processing directories. Only those files matching will be included in the jar archive. If null, then all files are included.
    `prefix` - The name of an arbitrary directory that will precede all entries in the jar archive. If null, then no prefix will be used.
    `man` - The manifest to use for the Jar archive. If null, then no manifest will be included.
  Throws:
    `IOException`

### unjar

    public static void unjar(InputStream in,
                             File dest)
                      throws IOException

  Dump the contents of a JarArchive to the dpecified destination.

  Throws:
    `IOException`

### extractNestedJar

    public static URL extractNestedJar(URL jarURL,
                                       File dest)
                                throws IOException

  Given a URL check if its a jar url(jar:!/archive) and if it is, extract the archive entry into the given dest directory and return a file URL to its location. If jarURL is not a jar url then it is simply returned as the URL for the jar.

  Parameters:
    `jarURL` - the URL to validate and extract the referenced entry if its a jar protocol URL
    `dest` - the directory into which the nested jar will be extracted.
  Returns:
    the file: URL for the jar referenced by the jarURL parameter.
  Throws:
    `IOException`

### main

    public static void main(String[] args)
                     throws Exception

  A simple jar-like tool used for testing. It's actually faster than jar, though doesn't sipport as many options.

  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.