public interface Archive extends Copyable
| Modifier and Type | Field and Description | 
|---|---|
static java.util.Comparator | 
ARCHIVE_ENTRY_NAME_COMPARATOR  | 
static int | 
BUFFER_SIZE  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addContents(ArchiveEntry archiveEntry)  | 
void | 
addContents(ArchiveEntry[] archiveEntries)
Fills in the manifest with all necessary information provided by
  the  
ArchiveEntry array passed in. | 
void | 
addContents(java.util.Collection archiveEntries)
Fills in the manifest with all necessary information provided by
  the  
Collection of ArchiveEntry instances
  passed in. | 
void | 
addContents(java.util.Collection archiveEntries,
           java.lang.String entryNamePrefix)
Fills in the manifest with all necessary information provided by
  the  
Collection of ArchiveEntry instances
  passed in. | 
void | 
addDirectoryTrees(java.net.URL[] dirs,
                 java.lang.String entryNamePrefix)  | 
boolean | 
containsEntry(java.lang.String entryName)  | 
java.util.Iterator<ArchiveEntry> | 
getArchiveEntries()
Returns an iterator to the contents that have been added to 
  the  
Archive instance so far. | 
int | 
getCompressionLevel()
Return the desired compression level. 
 | 
ArchiveEntry | 
getEntryByName(java.lang.String entryName)
Get a handle to an ArchiveEntry by its name. 
 | 
java.lang.String | 
getMainAttribute(java.lang.String attrName)
Returns the specified main attribute from the jar's manifest
  file. 
 | 
java.util.jar.Manifest | 
getManifest()
Returns the current  
Manifest. | 
java.lang.String | 
getManifestAsString()
Returns the current  
Manfiest as a String. | 
java.util.SortedSet | 
getMissingEntryNames()
Returns a  
SortedSet of entry names corresponding to
  entries which could not be found (i.e. | 
boolean | 
hasContents()
Returns whether the written jar file had any contents. 
 | 
boolean | 
isCompressed()  | 
boolean | 
isIncludeManifest()  | 
void | 
mergeManifest(java.util.jar.Manifest manifest)
Merges the given  
Manifest with the manifest
  currently held by Archive. | 
void | 
mergeManifest(java.net.URL manifestURL)
Merge the manifest at the specified  
URL. | 
ArchiveEntry | 
removeEntry(java.lang.String entryName)  | 
ArchiveEntry | 
renameEntry(java.lang.String fromName,
           java.lang.String toName)
Change the name of an ArchiveEntry. 
 | 
void | 
setCompressed(boolean compressed)
Sets whether the jar file that is written out should be
  compressed. 
 | 
void | 
setCompressionLevel(int level)
Set the desired compression level. 
 | 
void | 
setCreatedBy(java.lang.String creator)
Sets the  
Created-By main attribute for the manifest
  file. | 
void | 
setIncludeManifest(boolean includeManifest)  | 
void | 
setMainAttribute(java.lang.String attrName,
                java.lang.String attrValue)
Sets the specified main attribute for the jar's manifest file. 
 | 
void | 
setMainClass(java.lang.String mainClass)
Sets the  
Main-Class main attribute for the manifest
  file. | 
void | 
setReportNameCollisions(boolean reportNameCollisions)  | 
static final int BUFFER_SIZE
static final java.util.Comparator ARCHIVE_ENTRY_NAME_COMPARATOR
java.util.jar.Manifest getManifest()
Manifest.java.lang.String getManifestAsString()
                                     throws java.io.IOException
Manfiest as a String.
  If there is no manifest, null is returned.java.io.IOException - if an I/O exception occurs while converting
  the manifest contents to String.void setCreatedBy(java.lang.String creator)
Created-By main attribute for the manifest
  file.
  If creator is null, then the
  Created-By attribute is removed from the manifest.
java.lang.String getMainAttribute(java.lang.String attrName)
null if the attribute does not
  exist.  Throws IllegalArgumentException if the attribute name
  is not formatted properly.void setMainAttribute(java.lang.String attrName,
                    java.lang.String attrValue)
attrName is null this method does
  nothing.  If attrValue is null then
  the specified attribute is removed from the manifest's main
  attributes section.void setMainClass(java.lang.String mainClass)
Main-Class main attribute for the manifest
  file.  The Main-Class attribute allows a jar file to
  be used on the command line to launch an application, so that you
  can launch the application with a command like
  java -jar MyApp.jar.
  If mainClass is null, then the
  Main-Class attribute is removed from the manifest.
void setCompressed(boolean compressed)
void setCompressionLevel(int level)
level - the compression level, -1 or 0-9Deflaterboolean isIncludeManifest()
void setIncludeManifest(boolean includeManifest)
void setReportNameCollisions(boolean reportNameCollisions)
void mergeManifest(java.util.jar.Manifest manifest)
Manifest with the manifest
  currently held by Archive.void mergeManifest(java.net.URL manifestURL)
                   throws java.io.IOException
URL.java.io.IOExceptionvoid addContents(java.util.Collection archiveEntries,
               java.lang.String entryNamePrefix)
Collection of ArchiveEntry instances
  passed in.  This Collection is traversed in the order
  provided by its Iterator.  Before the collection of
  ArchiveEntrys is processed, the given
  entryNamePrefix is prepended to each
  ArchiveEntry's entryName.  This provides
  a convenient way of adding a collection of content to a particular
  directory tree within the archive (e.g. "WEB-INF/classes/").  If
  the entryNamePrefix represents a directory, it
  must end with a forward-slash ("/"), because there is no
  automatic insertion of any intermediate character during the
  prepending.void addContents(java.util.Collection archiveEntries)
Collection of ArchiveEntry instances
  passed in.  This Collection is traversed in the order
  provided by its Iterator.void addContents(ArchiveEntry archiveEntry)
boolean containsEntry(java.lang.String entryName)
ArchiveEntry removeEntry(java.lang.String entryName)
void addContents(ArchiveEntry[] archiveEntries)
ArchiveEntry array passed in.void addDirectoryTrees(java.net.URL[] dirs,
                     java.lang.String entryNamePrefix)
java.util.Iterator<ArchiveEntry> getArchiveEntries()
Archive instance so far.java.util.SortedSet getMissingEntryNames()
SortedSet of entry names corresponding to
  entries which could not be found (i.e. their URL is
  null).  This information is based on the entries that
  have been added through one of the addContent() methods
  up to the point in time that getMissingEntryNames() is
  called.  If no entries are missing, an empty SortedSet
  is returned.ArchiveEntry getEntryByName(java.lang.String entryName)
 ArchiveEntry e = archive.getEntryByName("WEB-INF/web.xml");
 entryName - ArchiveEntry renameEntry(java.lang.String fromName, java.lang.String toName)
fromName - toName - boolean hasContents()
writeJarFile() methods), then this will return
  false.boolean isCompressed()
int getCompressionLevel()
Deflater