public class Archive extends Object
| Constructor and Description |
|---|
Archive()
Public constructor.
|
Archive(String archiveName)
Public constructor.
|
Archive(String archiveName,
ZipInputStream archiveStream)
Public constructor.
|
Archive(ZipInputStream archiveStream)
Public constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Archive |
addClasspathResourceEntry(String path,
String resource)
Add the specified classpath resource as an entry in the deployment.
|
Archive |
addEntries(ZipInputStream zipStream)
Add the entries from the supplied
ZipInputStream to this archive instance. |
Archive |
addEntry(Class<?> clazz)
Add the supplied class as an entry in the deployment.
|
Archive |
addEntry(String path)
Add an "empty" entry in the deployment.
|
Archive |
addEntry(String path,
byte[] data)
Add the supplied data as an entry in the deployment.
|
Archive |
addEntry(String path,
InputStream data)
Add the supplied data as an entry in the deployment.
|
Archive |
addEntry(String path,
String data)
Add the supplied character data as an entry in the deployment.
|
boolean |
contains(String path) |
String |
getArchiveName()
Get the name of the deployment associated with this archive.
|
Map<String,File> |
getEntries()
Get the archive entries.
|
File |
getEntry(String resName)
Get an Archive entry file.
|
byte[] |
getEntryBytes(String resName)
Get an Archive entries bytes.
|
String |
getEntryName(int index)
Get the name of the entry at the specified index in the archive.
|
URL |
getEntryURL(String resName)
Get an Archive entry resource URL.
|
byte[] |
getEntryValue(int index)
Get the value of the entry at the specified index in the archive.
|
Archive |
merge(Archive archive) |
Archive |
removeEntry(String path)
Remove the archive entry at the specified path.
|
void |
toFile(File file)
Create an archive in the specified File containing entries
for the data contained in the streams supplied entries arg.
|
void |
toFileSystem(File outputFolder)
Output the entries to the specified output folder on the file system.
|
ZipInputStream |
toInputStream()
Create a
ZipInputStream for the entries defined in this
archive. |
void |
toOutputStream(ZipOutputStream archiveStream)
Create an archive of the specified name and containing entries
for the data contained in the streams supplied entries arg.
|
public Archive()
public Archive(String archiveName)
archiveName - The archive name of the deployment.public Archive(ZipInputStream archiveStream) throws IOException
archiveStream - Archive stream containing initial archive entries.IOException - Error reading from zip stream.public Archive(String archiveName, ZipInputStream archiveStream) throws IOException
archiveName - The archive name of the deployment.archiveStream - Archive stream containing initial archive entries.IOException - Error reading from zip stream.public String getArchiveName()
public Archive addEntry(String path, InputStream data) throws IOException
path - The target path of the entry when added to the archive.data - The data.IOException - Error reading from data stream.public Archive addEntry(Class<?> clazz) throws IOException
clazz - The class to be added.IOException - Failed to read class from classpath.public Archive addEntry(String path, byte[] data)
path - The target path of the entry when added to the archive.data - The data. Pass null to create a directory.public Archive addEntry(String path)
path - The target path of the entry when added to the archive.public Archive addClasspathResourceEntry(String path, String resource) throws IOException
path - The target path of the entry when added to the archive.resource - The classpath resource.IOException - Failed to read resource from classpath.public Archive addEntry(String path, String data)
path - The target path of the entry when added to the archive.data - The data.public Archive addEntries(ZipInputStream zipStream) throws IOException
ZipInputStream to this archive instance.zipStream - The zip stream.IOException - Error reading zip stream.public Archive removeEntry(String path)
path - The target path of the entry to be removed from the archive.public Map<String,File> getEntries()
Map of the archive entries.public String getEntryName(int index)
index - The index.public byte[] getEntryValue(int index)
index - The index.public byte[] getEntryBytes(String resName)
resName - Entry resource name.public File getEntry(String resName)
resName - Entry resource name.public URL getEntryURL(String resName)
resName - Entry resource name.public void toOutputStream(ZipOutputStream archiveStream) throws IOException
archiveStream - The archive output stream.IOException - Write failure.public void toFile(File file) throws IOException
file - The archive file.IOException - Write failure.public void toFileSystem(File outputFolder) throws IOException
outputFolder - The target output folder.IOException - Write failure.public ZipInputStream toInputStream() throws IOException
ZipInputStream for the entries defined in this
archive.ZipInputStream for the entries in this archive.IOException - Failed to create stream.public boolean contains(String path)
Copyright © 2020. All rights reserved.