org.objectweb.jonas_lib.genbase.utils
Class ArchiveStorer

java.lang.Object
  extended by org.objectweb.jonas_lib.genbase.utils.ArchiveStorer
Direct Known Subclasses:
DirStorer, JarStorer

public abstract class ArchiveStorer
extends java.lang.Object

Store an Archive in compressed or uncompressed format

Author:
Guillaume Sauthier

Field Summary
static int MAX_BUFFER_SIZE
          Buffer Size
 
Constructor Summary
ArchiveStorer(J2EEArchive archive)
          Creates a new ArchiveStorer object.
 
Method Summary
protected abstract  void addFile(java.lang.String name)
          add a file in saved archive
protected abstract  java.lang.String convertName(java.lang.String name)
          convert a filename from unix to windows filename and reverse
protected static void fill(java.io.InputStream is, java.io.OutputStream os)
          Fill an OutputStream with content from an InputStream
 J2EEArchive getArchive()
           
static I18n getI18n()
           
protected abstract  java.io.OutputStream getOutputStream(java.lang.String name)
          Returns an OutputStream from the given name
 void setOut(java.lang.String out)
           
 void store()
          Store the content of the contained archive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_BUFFER_SIZE

public static final int MAX_BUFFER_SIZE
Buffer Size

See Also:
Constant Field Values
Constructor Detail

ArchiveStorer

public ArchiveStorer(J2EEArchive archive)
Creates a new ArchiveStorer object.

Parameters:
archive - archive to be saved
Method Detail

fill

protected static void fill(java.io.InputStream is,
                           java.io.OutputStream os)
                    throws java.io.IOException
Fill an OutputStream with content from an InputStream

Parameters:
is - InputStream
os - OutputStream
Throws:
java.io.IOException - When filling fails

addFile

protected abstract void addFile(java.lang.String name)
                         throws java.io.IOException
add a file in saved archive

Parameters:
name - file name
Throws:
java.io.IOException - When save fails

convertName

protected abstract java.lang.String convertName(java.lang.String name)
convert a filename from unix to windows filename and reverse

Parameters:
name - name to be converted
Returns:
converted filename

getOutputStream

protected abstract java.io.OutputStream getOutputStream(java.lang.String name)
                                                 throws java.io.IOException
Returns an OutputStream from the given name

Parameters:
name - the filename we want to open/create
Returns:
an OutputStream from the given name
Throws:
java.io.IOException - When OS cannot be created

store

public void store()
           throws GenBaseException
Store the content of the contained archive.

Throws:
GenBaseException - When cannot add all files

getI18n

public static I18n getI18n()
Returns:
Returns the i18n.

getArchive

public J2EEArchive getArchive()
Returns:
Returns the archive.

setOut

public void setOut(java.lang.String out)
Parameters:
out - The out to set.