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