org.objectweb.jonas_lib.genbase.utils
Class JarStorer

java.lang.Object
  extended by org.objectweb.jonas_lib.genbase.utils.ArchiveStorer
      extended by org.objectweb.jonas_lib.genbase.utils.JarStorer

public class JarStorer
extends ArchiveStorer

Store a J2EEArchive in a Jar file.

Author:
Guillaume Sauthier

Field Summary
 
Fields inherited from class org.objectweb.jonas_lib.genbase.utils.ArchiveStorer
MAX_BUFFER_SIZE
 
Constructor Summary
JarStorer(J2EEArchive archive, java.io.File jar)
          Creates a new JarStorer object.
 
Method Summary
protected  void addFile(java.lang.String name)
          Add a file in Jar
protected  java.lang.String convertName(java.lang.String name)
          Convert a name from any format in Jar filename format
protected  java.io.OutputStream getOutputStream(java.lang.String name)
          returns the OuputStream corresponding to the given filename.
 void store()
          Store the archive and close the streams.
 
Methods inherited from class org.objectweb.jonas_lib.genbase.utils.ArchiveStorer
fill, getArchive, getI18n, setOut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarStorer

public JarStorer(J2EEArchive archive,
                 java.io.File jar)
          throws GenBaseException
Creates a new JarStorer object.

Parameters:
archive - archive to be stored
jar - outout jar file
Throws:
GenBaseException - When cannot create output jar
Method Detail

convertName

protected java.lang.String convertName(java.lang.String name)
Convert a name from any format in Jar filename format

Specified by:
convertName in class ArchiveStorer
Parameters:
name - filename to be converted
Returns:
converted filename

addFile

protected void addFile(java.lang.String name)
                throws java.io.IOException
Add a file in Jar

Specified by:
addFile in class ArchiveStorer
Parameters:
name - file name to be added
Throws:
java.io.IOException - when filling fails.

store

public void store()
           throws GenBaseException
Store the archive and close the streams.

Overrides:
store in class ArchiveStorer
Throws:
GenBaseException - When Output Jar cannot be closed

getOutputStream

protected java.io.OutputStream getOutputStream(java.lang.String name)
                                        throws java.io.IOException
returns the OuputStream corresponding to the given filename.

Specified by:
getOutputStream in class ArchiveStorer
Parameters:
name - filename to create
Returns:
An OutputStream
Throws:
java.io.IOException - When file creation fails.