sun.module
Class JamUtils

java.lang.Object
  extended by sun.module.JamUtils

public final class JamUtils
extends Object

Since:
1.7
Version:
1.12, 06/19/07
Author:
Stanley M. Ho, Andreas Sterbenz

Field Summary
static FilenameFilter CLASS_FILTER
           
static boolean DEBUG
           
static FileFilter DIRECTORY_FILTER
           
static FilenameFilter JAM_FILTER
           
static FilenameFilter JAM_JAR_FILTER
           
static FilenameFilter JAR_FILTER
           
 
Method Summary
static void expandJam(File sourceJam, File destDir)
           
static File getFile(URL url)
           
static Superpackage getSuperpackage(byte[] data)
           
static byte[] readFile(File file)
           
static byte[] readStream(InputStream in)
           
static void recursiveDelete(File dir)
          Recursively delete the given dir and all its contents.
static void storeContentAsFile(InputStream is, File outputFile)
          Read the content from the input stream and store the content in the output file.
static void unjam(File sourceJam, File destDir)
          Extracts all files from the sourceJam into destDir.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG

DIRECTORY_FILTER

public static final FileFilter DIRECTORY_FILTER

JAM_JAR_FILTER

public static final FilenameFilter JAM_JAR_FILTER

JAM_FILTER

public static final FilenameFilter JAM_FILTER

JAR_FILTER

public static final FilenameFilter JAR_FILTER

CLASS_FILTER

public static final FilenameFilter CLASS_FILTER
Method Detail

getFile

public static File getFile(URL url)
                    throws IOException
Throws:
IOException

readFile

public static byte[] readFile(File file)
                       throws IOException
Throws:
IOException

readStream

public static byte[] readStream(InputStream in)
                         throws IOException
Throws:
IOException

expandJam

public static void expandJam(File sourceJam,
                             File destDir)
                      throws IOException
Throws:
IOException

unjam

public static void unjam(File sourceJam,
                         File destDir)
                  throws IOException
Extracts all files from the sourceJam into destDir. Really, it's just "cd $destDir; jar xf $sourceJam".

Parameters:
sourceJam - .jam file to extract.
destDir - directory into which files are extracted.
Throws:
IOException - if any problem occurs.

storeContentAsFile

public static void storeContentAsFile(InputStream is,
                                      File outputFile)
                               throws IOException
Read the content from the input stream and store the content in the output file.

Parameters:
is - Input stream of the content.
Throws:
IOException

recursiveDelete

public static void recursiveDelete(File dir)
                            throws IOException
Recursively delete the given dir and all its contents.

Throws:
IOException

getSuperpackage

public static Superpackage getSuperpackage(byte[] data)
                                    throws ClassFormatError
Throws:
ClassFormatError