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

## com.sun.mdm.index.util
Class JarUtil

    java.lang.Object
      com.sun.mdm.index.util.JarUtil

public class JarUtil
extends java.lang.Object

Utilities for jar file manipulation

Field Summary
`(package private) static int` | `BUFFER_SIZE`
`static java.lang.String` | `ENC`

Method Summary
`static void` | `addEntryToJar(java.io.InputStream jarInputStream, java.io.OutputStream jarOutputStream, java.io.InputStream entryInputStream, java.lang.String entryName)` Add an entry to existing jar file
`static void` | `addEntryToJar(java.lang.String jarFileName, java.io.InputStream entryInputStream, java.lang.String entryName)` Add an entry to the jar file
`static void` | `addEntryToJar(java.lang.String jarFileName, java.lang.String fileToAdd, java.lang.String entryName)` Add an entry to the jar file
`static void` | `addPropertiesToJarFile(java.util.Properties props)` Add a property file to a jar file
`static void` | `addValuseToJarXmlEntry(java.lang.String path, java.lang.String jarName, java.lang.String targetXml, java.lang.String targetTag, java.lang.String values)`
`static void` | `copyJar(java.io.InputStream jarInputStream, java.io.OutputStream jarOutputStream)` Copy an existing jar file to another jar file
`static void` | `main(java.lang.String[] args)` Command line use
`static java.lang.String` | `readFileFromJar(java.lang.String path, java.lang.String jarName, java.lang.String fileName)`
`static void` | `replaceJarValues(java.lang.String path, java.lang.String jarName, java.lang.String entryName, java.util.Map values)` replaces strings in the entryName in a given jar file.

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

Field Detail

### BUFFER_SIZE

    static final int BUFFER_SIZE

See Also:
  Constant Field Values

### ENC

    public static final java.lang.String ENC

See Also:
  Constant Field Values

Method Detail

### addEntryToJar

    public static void addEntryToJar(java.io.InputStream jarInputStream,
                                     java.io.OutputStream jarOutputStream,
                                     java.io.InputStream entryInputStream,
                                     java.lang.String entryName)
                              throws java.io.IOException

  Add an entry to existing jar file

  Parameters:
    `jarInputStream` - stream representing jar file
    `jarOutputStream` - stream to put updated jar file
    `entryInputStream` - stream of data to be added to input
    `entryName` - name of entry to be added
  Throws:
    `java.io.IOException` - io error

### addEntryToJar

    public static void addEntryToJar(java.lang.String jarFileName,
                                     java.io.InputStream entryInputStream,
                                     java.lang.String entryName)
                              throws java.io.FileNotFoundException,
                                     java.io.IOException

  Add an entry to the jar file

  Parameters:
    `jarFileName` - full path to existing jar file
    `entryInputStream` - stream of data to be added
    `entryName` - name of entry as it should appear in jar file. Example: com/sun/mdm/index/con.properties
  Throws:
    `java.io.FileNotFoundException` - jarFile or fileToAdd not found
    `java.io.IOException` - error

### addEntryToJar

    public static void addEntryToJar(java.lang.String jarFileName,
                                     java.lang.String fileToAdd,
                                     java.lang.String entryName)
                              throws java.io.FileNotFoundException,
                                     java.io.IOException

  Add an entry to the jar file

  Parameters:
    `jarFileName` - full path to existing jar file
    `fileToAdd` - full path of file to be added
    `entryName` - name of entry as it should appear in jar file. Example: com/sun/mdm/index/con.properties
  Throws:
    `java.io.FileNotFoundException` - jarFile or fileToAdd not found
    `java.io.IOException` - error

### addPropertiesToJarFile

    public static void addPropertiesToJarFile(java.util.Properties props)
                                       throws java.io.IOException

  Add a property file to a jar file

  Parameters:
    `props` - prop file to be added
  Throws:
    `java.io.IOException` - error

### addValuseToJarXmlEntry

    public static void addValuseToJarXmlEntry(java.lang.String path,
                                              java.lang.String jarName,
                                              java.lang.String targetXml,
                                              java.lang.String targetTag,
                                              java.lang.String values)
                                       throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### copyJar

    public static void copyJar(java.io.InputStream jarInputStream,
                               java.io.OutputStream jarOutputStream)
                        throws java.io.IOException

  Copy an existing jar file to another jar file

  Parameters:
    `jarInputStream` - stream representing jar file
    `jarOutputStream` - stream to put updated jar file
  Throws:
    `java.io.IOException` - io error

### main

    public static void main(java.lang.String[] args)

  Command line use

  Parameters:
    `args` - 0:jarFile, 1:fileToAdd, 2:entryName

### readFileFromJar

    public static java.lang.String readFileFromJar(java.lang.String path,
                                                   java.lang.String jarName,
                                                   java.lang.String fileName)
                                            throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### replaceJarValues

    public static void replaceJarValues(java.lang.String path,
                                        java.lang.String jarName,
                                        java.lang.String entryName,
                                        java.util.Map values)
                                 throws java.lang.Exception

  replaces strings in the entryName in a given jar file. replacement strings are specified in Map values. An example is to replace ejb/MasterController to ejb/PersonMasaterController in entry seebeyond-ejb.xml in ejb_service.jar file.

  Parameters:
    `path` - path for the jar file
    `jarName` - name of jar file
  Throws:
    `java.lang.Exception`

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

Sun Microsystems, Inc.