/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* The Manifest class is used to maintain Manifest entry names and their
* associated Attributes. There are main Manifest Attributes as well as
* per-entry Attributes. For information on the Manifest format, please
* see the
* Manifest format specification</a>.
*
* @author David Connelly
* @see Attributes
* @since 1.2
*/
// manifest main attributes
// manifest entries
/**
* Constructs a new, empty Manifest.
*/
public Manifest() {
}
/**
* Constructs a new Manifest from the specified input stream.
*
* @param is the input stream containing manifest data
* @throws IOException if an I/O error has occured
*/
}
/**
* Constructs a new Manifest that is a copy of the specified Manifest.
*
* @param man the Manifest to copy
*/
}
/**
* Returns the main Attributes for the Manifest.
* @return the main Attributes for the Manifest
*/
return attr;
}
/**
* Returns a Map of the entries contained in this Manifest. Each entry
* is represented by a String name (key) and associated Attributes (value).
* The Map permits the {@code null} key, but no entry with a null key is
* created by {@link #read}, nor is such an entry written by using {@link
* #write}.
*
* @return a Map of the entries contained in this Manifest
*/
return entries;
}
/**
* Returns the Attributes for the specified entry name.
* This method is defined as:
* <pre>
* return (Attributes)getEntries().get(name)
* </pre>
* Though {@code null} is a valid {@code name}, when
* {@code getAttributes(null)} is invoked on a {@code Manifest}
* obtained from a jar file, {@code null} will be returned. While jar
* files themselves do not allow {@code null}-named attributes, it is
* possible to invoke {@link #getEntries} on a {@code Manifest}, and
* on that result, invoke {@code put} with a null key and an
* arbitrary value. Subsequent invocations of
* {@code getAttributes(null)} will return the just-{@code put}
* value.
* <p>
* Note that this method does not return the manifest's main attributes;
* see {@link #getMainAttributes}.
*
* @param name entry name
* @return the Attributes for the specified entry name
*/
}
/**
* Clears the main Attributes as well as the entries in this Manifest.
*/
public void clear() {
}
/**
* Writes the Manifest to the specified OutputStream.
* Attributes.Name.MANIFEST_VERSION must be set in
* MainAttributes prior to invoking this method.
*
* @param out the output stream
* @exception IOException if an I/O error has occurred
* @see #getMainAttributes
*/
// Write out the main attributes for the manifest
// Now write out the pre-entry attributes
}
}
}
/**
* Adds line breaks to enforce a maximum 72 bytes per line.
*/
if (length > 72) {
int index = 70;
index += 72;
length += 3;
}
}
return;
}
/**
* Reads the Manifest from the specified InputStream. The entry
* names and attributes read will be merged in with the current
* manifest entries.
*
* @param is the input stream
* @exception IOException if an I/O error has occurred
*/
// Buffered input stream for reading manifest data
// Line buffer
byte[] lbuf = new byte[512];
// Read the main attributes for the manifest
// Total number of entries, attributes read
// Average size of entry attributes
int asize = 2;
// Now parse the manifest entries
int len;
boolean skipEmptyLines = true;
throw new IOException("manifest line too long");
}
--len;
}
continue;
}
skipEmptyLines = false;
throw new IOException("invalid manifest format");
}
// name is wrapped
continue;
}
} else {
// continuation line
// name is wrapped
continue;
}
}
}
ecount++;
//XXX: Fix for when the average is 0. When it is 0,
// you get an Attributes object with an initial
// capacity of 0, which tickles a bug in HashMap.
skipEmptyLines = true;
}
}
try {
}
catch (Exception e) {
}
}
return null;
}
private int toLower(int c) {
return (c >= 'A' && c <= 'Z') ? 'a' + (c - 'A') : c;
}
/**
* Returns true if the specified Object is also a Manifest and has
* the same main Attributes and entries.
*
* @param o the object to be compared
* @return true if the specified Object is also a Manifest and has
* the same main Attributes and entries
*/
if (o instanceof Manifest) {
} else {
return false;
}
}
/**
* Returns the hash code for this Manifest.
*/
public int hashCode() {
}
/**
* Returns a shallow copy of this Manifest. The shallow copy is
* implemented as follows:
* <pre>
* public Object clone() { return new Manifest(this); }
* </pre>
* @return a shallow copy of this Manifest
*/
return new Manifest(this);
}
/*
* A fast buffered input stream for parsing manifest files.
*/
private byte buf[];
this(in, 8192);
}
super(in);
}
fill();
return -1;
}
}
}
if (avail <= 0) {
}
fill();
if (avail <= 0) {
return -1;
}
}
}
return len;
}
/*
* Reads 'len' bytes from the input stream, or until an end-of-line
* is reached. Returns the number of bytes read.
*/
int total = 0;
if (avail <= 0) {
fill();
if (avail <= 0) {
return -1;
}
}
if (n > avail) {
n = avail;
}
off += n;
total += n;
break;
}
}
return total;
}
fill();
return -1; // nothing left in buffer
}
}
if (n <= 0) {
return 0;
}
if (avail <= 0) {
}
if (n > avail) {
n = avail;
}
pos += n;
return n;
}
}
}
}
if (n > 0) {
count = n;
}
}
}
}