public class SrampArchive extends Object
| Constructor and Description |
|---|
SrampArchive()
Creates a new, empty S-RAMP archive.
|
SrampArchive(File file)
Creates an S-RAMP archive from an existing archive file.
|
SrampArchive(InputStream input)
Creates an S-RAMP archive from an
InputStream. |
| Modifier and Type | Method and Description |
|---|---|
void |
addEntry(String path,
org.oasis_open.docs.s_ramp.ns.s_ramp_v1.BaseArtifactType metaData,
InputStream content)
Adds an entry to the S-RAMP archive.
|
void |
close()
The S-RAMP archive should always be closed when the client is done with it.
|
static void |
closeQuietly(SrampArchive archive)
Close the archive quietly (eat any
IOException). |
boolean |
containsEntry(String archivePath)
Returns true if the s-ramp archive contains an entry at the given path.
|
Collection<SrampArchiveEntry> |
getEntries()
Gets all of the entries found in this S-RAMP archive.
|
SrampArchiveEntry |
getEntry(String archivePath)
Gets a single entry in the archive by path.
|
InputStream |
getInputStream(SrampArchiveEntry entry)
Gets the content
InputStream for the given S-RAMP archive entry. |
File |
pack()
Packs up the current contents of the S-RAMP archive into a single (.zip) file and
returns a reference to it.
|
boolean |
removeEntry(String archivePath)
Removes the s-ramp archive entry at the given path if it exists.
|
void |
updateEntry(SrampArchiveEntry entry,
InputStream content)
Updates an existing entry in the S-RAMP archive.
|
public SrampArchive()
throws SrampArchiveException
SrampArchiveExceptionpublic SrampArchive(File file) throws SrampArchiveException
file - SrampArchiveExceptionpublic SrampArchive(InputStream input) throws SrampArchiveException
InputStream. This will consume and close the
InputStream, creating a temporary local file that will be used as the basis for
the archive input.input - SrampArchiveExceptionpublic void close()
throws IOException
IOExceptionpublic static void closeQuietly(SrampArchive archive)
IOException).archive - public Collection<SrampArchiveEntry> getEntries() throws SrampArchiveException
SrampArchiveExceptionpublic InputStream getInputStream(SrampArchiveEntry entry) throws IOException
InputStream for the given S-RAMP archive entry.entry - the s-ramp archive entryInputStream over the artifact content or null if no content found (meta-data only)IOExceptionpublic void addEntry(String path, org.oasis_open.docs.s_ramp.ns.s_ramp_v1.BaseArtifactType metaData, InputStream content) throws SrampArchiveException
InputStream.path - the path in the archive (usually just the name of the artifact)metaData - the artifact meta-datacontent - the entry content (or null if a meta-data only entry)SrampArchiveExceptionpublic void updateEntry(SrampArchiveEntry entry, InputStream content) throws SrampArchiveException
InputStream.entry - the archive entry (or null if just udpating the content)content - the entry content (or null if just updating meta data)SrampArchiveExceptionpublic File pack() throws SrampArchiveException
File. It will never throw and leave a temporary file
behind.SrampArchiveExceptionpublic SrampArchiveEntry getEntry(String archivePath)
archivePath - the path of the entry within the archivepublic boolean containsEntry(String archivePath)
archivePath - path to the entry within the archivepublic boolean removeEntry(String archivePath)
archivePath - path to the entry within the archiveCopyright © 2011-2014 JBoss, a division of Red Hat. All Rights Reserved.