Class OutputJarArchive
- java.lang.Object
-
- com.sun.enterprise.deployment.deploy.shared.JarArchive
-
- com.sun.enterprise.deployment.deploy.shared.OutputJarArchive
-
- All Implemented Interfaces:
Archive
,WritableArchive
@Service(name="jar") @PerLookup public class OutputJarArchive extends JarArchive implements WritableArchive
Provides an implementation of the Archive that maps to a Jar file @see java.util.jar.JarFile- Author:
- Jerome Dochez
-
-
Field Summary
Fields Modifier and Type Field Description protected ZipOutputStream
jos
-
Fields inherited from class com.sun.enterprise.deployment.deploy.shared.JarArchive
archiveMetaData, extraData, parentArchive
-
-
Constructor Summary
Constructors Constructor Description OutputJarArchive()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
close the abstract archivevoid
closeEntry()
closes the current entryvoid
closeEntry(WritableArchive subArchive)
Close a previously returned sub archivevoid
create(URI path)
creates a new abstract archive with the given pathWritableArchive
createSubArchive(String name)
Returns an instance of this archive abstraction for an embedded archive within this archive.Enumeration
entries()
Returns an enumeration of the module file entries.Enumeration
entries(Enumeration embeddedArchives)
long
getArchiveSize()
Get the size of the archiveCollection<String>
getDirectories()
Returns the enumeration of first level directories in this archiveprotected JarEntry
getJarEntry(String entryName)
Manifest
getManifest()
Returns the manifest information for this archiveURI
getURI()
Returns the path used to create or open the underlyong archiveOutputStream
putNextEntry(String name)
Create a new entry in the archive-
Methods inherited from class com.sun.enterprise.deployment.deploy.shared.JarArchive
addArchiveMetaData, entries, exists, getArchiveMetaData, getExtraData, getName, getParentArchive, isDirectory, removeArchiveMetaData, removeExtraData, setExtraData, setParentArchive
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.glassfish.api.deployment.archive.Archive
entries, getName, isDirectory
-
-
-
-
Field Detail
-
jos
protected ZipOutputStream jos
-
-
Method Detail
-
getArchiveSize
public long getArchiveSize() throws NullPointerException, SecurityException
Get the size of the archive- Specified by:
getArchiveSize
in interfaceArchive
- Returns:
- -1 because this is getting created
- Throws:
NullPointerException
SecurityException
-
close
public void close() throws IOException
close the abstract archive- Specified by:
close
in interfaceArchive
- Throws:
IOException
-
getJarEntry
protected JarEntry getJarEntry(String entryName)
- Specified by:
getJarEntry
in classJarArchive
-
create
public void create(URI path) throws IOException
creates a new abstract archive with the given path- Specified by:
create
in interfaceWritableArchive
- Parameters:
path
- the path to create the archive- Throws:
IOException
-
entries
public Enumeration entries()
Description copied from interface:Archive
Returns an enumeration of the module file entries. All elements in the enumeration are of type String. Each String represents a file name relative to the root of the module.
-
getDirectories
public Collection<String> getDirectories() throws IOException
Description copied from interface:Archive
Returns the enumeration of first level directories in this archive- Specified by:
getDirectories
in interfaceArchive
- Returns:
- enumeration of directories under the root of this archive
- Throws:
IOException
-
entries
public Enumeration entries(Enumeration embeddedArchives)
- Returns:
- an @see java.util.Enumeration of entries in this abstract archive, providing the list of embedded archive to not count their entries as part of this archive
-
getManifest
public Manifest getManifest() throws IOException
Description copied from interface:Archive
Returns the manifest information for this archive- Specified by:
getManifest
in interfaceArchive
- Returns:
- the manifest information for this abstract archive
- Throws:
IOException
-
getURI
public URI getURI()
Returns the path used to create or open the underlyong archive
-
createSubArchive
public WritableArchive createSubArchive(String name) throws IOException
Description copied from interface:WritableArchive
Returns an instance of this archive abstraction for an embedded archive within this archive.- Specified by:
createSubArchive
in interfaceWritableArchive
- Parameters:
name
- is the entry name relative to the root for the archive- Returns:
- the Archive instance for this abstraction
- Throws:
IOException
-
closeEntry
public void closeEntry(WritableArchive subArchive) throws IOException
Close a previously returned sub archive- Specified by:
closeEntry
in interfaceWritableArchive
- Parameters:
subArchive
- output stream to close- Throws:
IOException
-
putNextEntry
public OutputStream putNextEntry(String name) throws IOException
Description copied from interface:WritableArchive
Create a new entry in the archive- Specified by:
putNextEntry
in interfaceWritableArchive
- Parameters:
name
- the entry name- Throws:
IOException
-
closeEntry
public void closeEntry() throws IOException
closes the current entry- Specified by:
closeEntry
in interfaceWritableArchive
- Throws:
IOException
-
-