< prev index next >
src/share/classes/com/sun/java/util/jar/pack/AdaptiveCoding.java
Print this page
rev 1378 : 7003227: (pack200) intermittent failures compiling pack200
Reviewed-by: jjg
rev 1380 : 6990106: FindBugs scan - Malicious code vulnerability Warnings in com.sun.java.util.jar.pack.*
7006704: (pack200) add missing file for 6990106
Reviewed-by: mduigou, briangoetz
*** 1,7 ****
/*
! * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 23,41 ****
* questions.
*/
package com.sun.java.util.jar.pack;
! import java.util.*;
! import java.io.*;
/**
* Adaptive coding.
* See the section "Adaptive Encodings" in the Pack200 spec.
* @author John Rose
*/
! class AdaptiveCoding implements Constants, CodingMethod {
CodingMethod headCoding;
int headLength;
CodingMethod tailCoding;
public AdaptiveCoding(int headLength, CodingMethod headCoding, CodingMethod tailCoding) {
--- 23,44 ----
* questions.
*/
package com.sun.java.util.jar.pack;
! import java.io.ByteArrayOutputStream;
! import java.io.IOException;
! import java.io.InputStream;
! import java.io.OutputStream;
! import static com.sun.java.util.jar.pack.Constants.*;
/**
* Adaptive coding.
* See the section "Adaptive Encodings" in the Pack200 spec.
* @author John Rose
*/
! class AdaptiveCoding implements CodingMethod {
CodingMethod headCoding;
int headLength;
CodingMethod tailCoding;
public AdaptiveCoding(int headLength, CodingMethod headCoding, CodingMethod tailCoding) {
*** 143,153 ****
assert(getKXOf(K1) == KX);
return K1;
}
if (KX == KX_MAX) return Integer.MAX_VALUE;
KX += 1;
- int unit2 = 1 << (KX * KX_LG2BASE);
int mask2 = KB_MAX << (KX * KX_LG2BASE);
K1 |= (mask & ~mask2);
K1 += unit;
assert(getKXOf(K1) == KX);
return K1;
--- 146,155 ----
*** 246,256 ****
if (m instanceof Coding)
return ((Coding)m).keyString();
return m.toString();
}
public String toString() {
! StringBuffer res = new StringBuffer(20);
AdaptiveCoding run = this;
res.append("run(");
for (;;) {
res.append(run.headLength).append("*");
res.append(keyString(run.headCoding));
--- 248,258 ----
if (m instanceof Coding)
return ((Coding)m).keyString();
return m.toString();
}
public String toString() {
! StringBuilder res = new StringBuilder(20);
AdaptiveCoding run = this;
res.append("run(");
for (;;) {
res.append(run.headLength).append("*");
res.append(keyString(run.headCoding));
< prev index next >