@Service(name="jar") @PerLookup public class InputJarArchive extends JarArchive implements ReadableArchive
Modifier and Type | Field and Description |
---|---|
static Logger |
deplLogger |
protected JarFile |
jarFile |
protected JarInputStream |
jarIS |
archiveMetaData, extraData
Constructor and Description |
---|
InputJarArchive() |
Modifier and Type | Method and Description |
---|---|
OutputStream |
addEntry(String name) |
void |
close()
close the abstract archive
|
void |
create(URI uri)
creates a new abstract archive with the given path
|
boolean |
delete()
deletes the underlying jar file
|
Enumeration<String> |
entries()
Returns an enumeration of the module file entries.
|
Enumeration |
entries(Enumeration embeddedArchives) |
boolean |
exists() |
boolean |
exists(String name)
Returns the existence of the given entry name
The file name must be relative to the root of the module.
|
long |
getArchiveSize()
Get the size of the archive
|
Collection<String> |
getDirectories()
Returns the collection of first level directories in this
archive.
|
InputStream |
getEntry(String entryName)
Returns the InputStream for the given entry name
The file name must be relative to the root of the module.
|
long |
getEntrySize(String name)
Returns the entry size for a given entry name or 0 if not known
|
JarEntry |
getJarEntry(String name) |
protected static JarFile |
getJarFile(URI uri) |
Manifest |
getManifest()
Returns the manifest information for this archive
|
ReadableArchive |
getSubArchive(String name)
Returns an instance of this archive abstraction for an embedded
archive within this archive.
|
URI |
getURI()
Returns the path used to create or open the underlying archive
|
void |
open(URI uri)
Open an abstract archive
|
boolean |
renameTo(String name)
rename the underlying jar file
|
addArchiveMetaData, entries, getArchiveMetaData, getExtraData, getName, getParentArchive, isDirectory, removeArchiveMetaData, removeExtraData, setExtraData, setParentArchive
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addArchiveMetaData, getArchiveMetaData, getExtraData, getParentArchive, removeArchiveMetaData, removeExtraData, setExtraData, setParentArchive
entries, getName, isDirectory
public static final Logger deplLogger
protected volatile JarFile jarFile
protected volatile JarInputStream jarIS
public long getArchiveSize() throws NullPointerException, SecurityException
getArchiveSize
in interface Archive
NullPointerException
SecurityException
public OutputStream addEntry(String name) throws IOException
name
- the entry nameIOException
public void close() throws IOException
close
in interface Archive
IOException
public Collection<String> getDirectories() throws IOException
Avoid having to fetch all the entries if we can avoid it. The only time we must do that is if size() is invoked on the collection. Use the CollectionWrappedEnumeration for this optimization which will create a full in-memory list of the entries only if and when needed to satisfy the size() method.
getDirectories
in interface Archive
IOException
public void create(URI uri) throws IOException
uri
- the path to create the archiveIOException
public Enumeration<String> entries()
Archive
public Enumeration entries(Enumeration embeddedArchives)
public JarEntry getJarEntry(String name)
getJarEntry
in class JarArchive
public boolean exists(String name) throws IOException
exists
in interface ReadableArchive
exists
in class JarArchive
name
- the file name relative to the root of the module. * @return the existence the given entry name.IOException
public InputStream getEntry(String entryName) throws IOException
ReadableArchive
getEntry
in interface ReadableArchive
entryName
- entry nameIOException
public long getEntrySize(String name)
getEntrySize
in interface ReadableArchive
name
- the entry namepublic void open(URI uri) throws IOException
open
in interface ReadableArchive
uri
- the path to the archiveIOException
protected static JarFile getJarFile(URI uri) throws IOException
IOException
public Manifest getManifest() throws IOException
Archive
getManifest
in interface Archive
IOException
public URI getURI()
public boolean exists()
exists
in interface ReadableArchive
public boolean delete()
delete
in interface ReadableArchive
public boolean renameTo(String name)
renameTo
in interface ReadableArchive
name
- the archive namepublic ReadableArchive getSubArchive(String name) throws IOException
ReadableArchive
getSubArchive
in interface ReadableArchive
name
- is the entry name relative to the root for the archiveIOException
Copyright © 2020. All rights reserved.