/*
* 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.
*/
/**
* This class is used to compute digests on sections of the Manifest.
*/
public class ManifestDigester {
/** the raw bytes of the manifest */
private byte rawBytes[];
/** state returned by findSection */
static class Position {
// between sections
}
/**
* find a section in the manifest.
*
* @param offset should point to the starting offset with in the
* raw bytes of the next section.
*
* @pos set by
*
* @returns false if end of bytes has been reached, otherwise returns
* true
*/
{
int next;
boolean allBlank = true;
while (i < len) {
byte b = rawBytes[i];
switch(b) {
case '\r':
i++;
case '\n':
if (i == len-1)
pos.endOfSection = i;
else
return true;
}
else {
// start of a new line
last = i;
allBlank = true;
}
break;
default:
allBlank = false;
break;
}
i++;
}
return false;
}
{
return; // XXX: exception?
// create an entry for main attributes
if (len > 6) {
try {
if ((i-start) < sectionLen) {
if (bytes[i] == '\r') {
i += 2;
} else {
i += 1;
}
}
while ((i-start) < sectionLen) {
if (bytes[i++] == ' ') {
// name is wrapped
int wrapStart = i;
while (((i-start) < sectionLen)
&& (bytes[i++] != '\n'));
return; // XXX: exception?
int wrapLen;
else
wrapLen, "UTF8"));
} else {
break;
}
}
rawBytes));
throw new IllegalStateException(
"UTF8 not available on platform");
}
}
}
}
}
{
}
public static class Entry {
int offset;
int length;
int lengthWithBlankLine;
byte[] rawBytes;
boolean oldStyle;
int lengthWithBlankLine, byte[] rawBytes)
{
}
{
if (oldStyle) {
} else {
}
}
byte[] bytes,
int offset,
int length)
{
// this is too gross to even document, but here goes
// the 1.1 jar verification code ignored spaces at the
// end of lines when calculating digests, so that is
// what this code does. It only gets called if we
// are parsing a 1.1 signed signature file
int i = offset;
int prev = -1;
while(i <max) {
start = i;
}
i++;
}
}
/** Netscape doesn't include the new line. Intel and JavaSoft do */
{
}
}
if (e != null)
return e;
}
{
}
}