harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r647100 [1/9] - in /harmony/enhanced/classlib/trunk/modules/pack200/src: main/java/org/apache/harmony/pack200/ main/java/org/apache/harmony/pack200/bytecode/ main/java/org/apache/harmony/pack200/bytecode/forms/ test/java/org/apache/harmony/...
Date Fri, 11 Apr 2008 10:10:00 GMT
Author: sjanuary
Date: Fri Apr 11 03:09:38 2008
New Revision: 647100

URL: http://svn.apache.org/viewvc?rev=647100&view=rev
Log:
Pack200 formatting.  Mainly converts tabs to 4 spaces and formats comments and long lines etc.

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttrDefinitionBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Codec.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CodecEncoding.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IMatcher.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcTuple.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/NewAttributeBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Pack200Exception.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/RunCodec.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentConstantPool.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentOptions.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentUtils.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationDefaultAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationsAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/BCIRenumberedAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ByteCode.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPClass.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPConstant.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPConstantNumber.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPDouble.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPField.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFieldRef.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFloat.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInteger.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInterfaceMethodRef.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPLong.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMember.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMethod.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMethodRef.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPRef.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFile.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFileEntry.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CodeAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantPoolEntry.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/DeprecatedAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/EnclosingMethodAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionTableEntry.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/NewAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/OperandManager.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ByteCodeForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ByteForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ClassRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ClassSpecificReferenceForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/DoubleForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/FieldRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/FloatRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IMethodRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IincForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/InitMethodReferenceForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IntRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LabelForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LocalForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LongForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LookupSwitchForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/MethodRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/MultiANewArrayForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NarrowClassRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NewClassRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NewInitMethodRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NoArgumentForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ReferenceForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ShortForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SingleByteReferenceForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/StringRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperFieldRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperInitMethodRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperMethodRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SwitchForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/TableSwitchForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisFieldRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisInitMethodRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisMethodRefForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/VariableInstructionForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/WideForm.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AbstractBandsTestCase.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutMapTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BHSDCodecTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BandSetTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CPUTF8Test.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassVersionTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodeAttributeTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/HelloWorld.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ICTupleTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentConstantPoolTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentUtilsTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ByteCodeTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ConstantPoolTest.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java Fri Apr 11 03:09:38 2008
@@ -53,13 +53,15 @@
 
     private String inputFileName;
 
-	private String outputFileName;
+    private String outputFileName;
 
     /**
      * Creates an Archive with the given input and output file names.
+     * 
      * @param inputFile
      * @param outputFile
-     * @throws FileNotFoundException if the input file does not exist
+     * @throws FileNotFoundException
+     *             if the input file does not exist
      * @throws IOException
      */
     public Archive(String inputFile, String outputFile)
@@ -71,9 +73,10 @@
     }
 
     /**
-     * Creates an Archive with streams for the input and output files.
-     * Note: If you use this method then calling {@link #setRemovePackFile(boolean)}
-     * will have no effect.
+     * Creates an Archive with streams for the input and output files. Note: If
+     * you use this method then calling {@link #setRemovePackFile(boolean)} will
+     * have no effect.
+     * 
      * @param inputStream
      * @param outputStream
      * @throws IOException
@@ -86,6 +89,7 @@
 
     /**
      * Unpacks the Archive from the input file to the output file
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
@@ -106,7 +110,8 @@
                 inputStream.reset();
             }
             inputStream.mark(4);
-            int[] magic = { 0xCA, 0xFE, 0xD0, 0x0D }; // Magic word for pack200
+            int[] magic = { 0xCA, 0xFE, 0xD0, 0x0D }; // Magic word for
+            // pack200
             int word[] = new int[4];
             for (int i = 0; i < word.length; i++) {
                 word[i] = inputStream.read();
@@ -118,62 +123,69 @@
                 }
             }
             inputStream.reset();
-            if(compressedWithE0) { // The original Jar was not packed, so just copy it across
+            if (compressedWithE0) { // The original Jar was not packed, so just
+                // copy it across
                 JarInputStream jarInputStream = new JarInputStream(inputStream);
                 JarEntry jarEntry;
-                while((jarEntry = jarInputStream.getNextJarEntry()) != null) {
+                while ((jarEntry = jarInputStream.getNextJarEntry()) != null) {
                     outputStream.putNextEntry(jarEntry);
                     byte[] bytes = new byte[16384];
                     int bytesRead = jarInputStream.read(bytes);
-                    while(bytesRead != -1) {
+                    while (bytesRead != -1) {
                         outputStream.write(bytes, 0, bytesRead);
                         bytesRead = jarInputStream.read(bytes);
                     }
                     outputStream.closeEntry();
                 }
             } else {
-            	int i = 0;
+                int i = 0;
                 while (available(inputStream)) {
-                	i++;
+                    i++;
                     Segment segment = new Segment();
                     segment.setLogLevel(logLevel);
-                    segment.setLogStream(logFile != null ? (OutputStream) logFile
-                            : (OutputStream) System.out);
+                    segment
+                            .setLogStream(logFile != null ? (OutputStream) logFile
+                                    : (OutputStream) System.out);
                     if (i == 1) {
-						segment.log(Segment.LOG_LEVEL_VERBOSE,
-								"Unpacking from " + inputFileName + " to "
-										+ outputFileName);
-					}
-                    segment.log(Segment.LOG_LEVEL_VERBOSE, "Reading segment " + i);
+                        segment.log(Segment.LOG_LEVEL_VERBOSE,
+                                "Unpacking from " + inputFileName + " to "
+                                        + outputFileName);
+                    }
+                    segment.log(Segment.LOG_LEVEL_VERBOSE, "Reading segment "
+                            + i);
                     if (overrideDeflateHint) {
                         segment.overrideDeflateHint(deflateHint);
                     }
                     segment.unpack(inputStream, outputStream);
                     outputStream.flush();
 
-                    if(inputStream instanceof FileInputStream) {
-                    	inputFileName = ((FileInputStream)inputStream).getFD().toString();
+                    if (inputStream instanceof FileInputStream) {
+                        inputFileName = ((FileInputStream) inputStream).getFD()
+                                .toString();
                     }
                 }
             }
         } finally {
             try {
                 inputStream.close();
-            } catch (Exception e) {}
+            } catch (Exception e) {
+            }
             try {
                 outputStream.close();
-            } catch (Exception e) {}
-            if(logFile != null) {
-            	try {
-            		logFile.close();
-            	} catch (Exception e) {}
+            } catch (Exception e) {
+            }
+            if (logFile != null) {
+                try {
+                    logFile.close();
+                } catch (Exception e) {
+                }
             }
         }
         if (removePackFile) {
             File file = new File(inputFileName);
             boolean deleted = file.delete();
-            if(!deleted) {
-            	throw new Pack200Exception("Failed to delete the input file.");
+            if (!deleted) {
+                throw new Pack200Exception("Failed to delete the input file.");
             }
         }
     }
@@ -188,7 +200,7 @@
     /**
      * If removePackFile is set to true, the input file is deleted after
      * unpacking
-     *
+     * 
      * @param removePackFile
      */
     public void setRemovePackFile(boolean removePackFile) {

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttrDefinitionBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttrDefinitionBands.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttrDefinitionBands.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttrDefinitionBands.java Fri Apr 11 03:09:38 2008
@@ -40,11 +40,12 @@
         this.cpUTF8 = segment.getCpBands().getCpUTF8();
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.harmony.pack200.BandSet#unpack(java.io.InputStream)
      */
-    public void unpack(InputStream in) throws IOException,
-            Pack200Exception {
+    public void unpack(InputStream in) throws IOException, Pack200Exception {
         int attributeDefinitionCount = header.getAttributeDefinitionCount();
         attributeDefinitionHeader = decodeBandInt("attr_definition_headers",
                 in, Codec.BYTE1, attributeDefinitionCount);
@@ -56,13 +57,13 @@
         attributeDefinitionMap = new AttributeLayoutMap();
 
         int overflowIndex = 32;
-        if(segment.getSegmentHeader().getOptions().hasClassFlagsHi()) {
+        if (segment.getSegmentHeader().getOptions().hasClassFlagsHi()) {
             overflowIndex = 63;
         }
         for (int i = 0; i < attributeDefinitionCount; i++) {
             int context = attributeDefinitionHeader[i] & 0x03;
             int index = (attributeDefinitionHeader[i] >> 2) - 1;
-            if(index == -1) {
+            if (index == -1) {
                 index = overflowIndex++;
             }
             AttributeLayout layout = new AttributeLayout(

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java Fri Apr 11 03:09:38 2008
@@ -22,102 +22,101 @@
  */
 public class AttributeLayout implements IMatcher {
 
-	public static final String ACC_ABSTRACT = "ACC_ABSTRACT"; //$NON-NLS-1$
-	public static final String ACC_ANNOTATION = "ACC_ANNOTATION"; //$NON-NLS-1$
-	public static final String ACC_ENUM = "ACC_ENUM"; //$NON-NLS-1$
-	public static final String ACC_FINAL = "ACC_FINAL"; //$NON-NLS-1$
-	public static final String ACC_INTERFACE = "ACC_INTERFACE"; //$NON-NLS-1$
-	public static final String ACC_NATIVE = "ACC_NATIVE"; //$NON-NLS-1$
-	public static final String ACC_PRIVATE = "ACC_PRIVATE"; //$NON-NLS-1$
-	public static final String ACC_PROTECTED = "ACC_PROTECTED"; //$NON-NLS-1$
-	public static final String ACC_PUBLIC = "ACC_PUBLIC"; //$NON-NLS-1$
-	public static final String ACC_STATIC = "ACC_STATIC"; //$NON-NLS-1$
-	public static final String ACC_STRICT = "ACC_STRICT"; //$NON-NLS-1$
-	public static final String ACC_SYNCHRONIZED = "ACC_SYNCHRONIZED"; //$NON-NLS-1$
-	public static final String ACC_SYNTHETIC = "ACC_SYNTHETIC"; //$NON-NLS-1$
-	public static final String ACC_TRANSIENT = "ACC_TRANSIENT"; //$NON-NLS-1$
-	public static final String ACC_VOLATILE = "ACC_VOLATILE"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_ANNOTATION_DEFAULT = "AnnotationDefault"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_CLASS_FILE_VERSION = "class-file version"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_CODE = "Code"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_CONSTANT_VALUE = "ConstantValue"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_DEPRECATED = "Deprecated"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_ENCLOSING_METHOD = "EnclosingMethod"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_EXCEPTIONS = "Exceptions"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_INNER_CLASSES = "InnerClasses"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_LINE_NUMBER_TABLE = "LineNumberTable"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_LOCAL_VARIABLE_TABLE = "LocalVariableTable"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_LOCAL_VARIABLE_TYPE_TABLE = "LocalVariableTypeTable"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_RUNTIME_INVISIBLE_ANNOTATIONS = "RuntimeInvisibleAnnotations"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = "RuntimeInvisibleParameterAnnotations"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_RUNTIME_VISIBLE_ANNOTATIONS = "RuntimeVisibleAnnotations"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = "RuntimeVisibleParameterAnnotations"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_SIGNATURE = "Signature"; //$NON-NLS-1$
-	public static final String ATTRIBUTE_SOURCE_FILE = "SourceFile"; //$NON-NLS-1$
-	public static final int CONTEXT_CLASS = 0;
-	public static final int CONTEXT_CODE = 3;
-	public static final int CONTEXT_FIELD = 1;
-	public static final int CONTEXT_METHOD = 2;
-	public static final String[] contextNames = { "Class", "Field", "Method", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-			"Code", }; //$NON-NLS-1$
-
-	private static Object getValue(String layout, long value, SegmentConstantPool pool)
-			throws Pack200Exception {
-		if (layout.startsWith("R")) { //$NON-NLS-1$
-			// references
-			if (layout.indexOf('N') != -1)
-				value--;
-			if (layout.startsWith("RU")) { //$NON-NLS-1$
-				return pool.getValue(SegmentConstantPool.UTF_8, value);
-			} else if (layout.startsWith("RS")) { //$NON-NLS-1$
-				return pool.getValue(SegmentConstantPool.SIGNATURE, value);
-			}
-		} else if (layout.startsWith("K")) { //$NON-NLS-1$
-			char type = layout.charAt(1);
-			switch (type) {
-			case 'S': // String
-				return pool.getValue(SegmentConstantPool.CP_STRING, value);
-			case 'I': // Int (or byte or short)
-			case 'C': // Char
-				return pool.getValue(SegmentConstantPool.CP_INT, value);
-			case 'F': // Float
-				return pool.getValue(SegmentConstantPool.CP_FLOAT, value);
-			case 'J': // Long
-				return pool.getValue(SegmentConstantPool.CP_LONG, value);
-			case 'D': // Double
-				return pool.getValue(SegmentConstantPool.CP_DOUBLE, value);
-			}
-		}
-		throw new Pack200Exception("Unknown layout encoding: " + layout);
-	}
-
+    public static final String ACC_ABSTRACT = "ACC_ABSTRACT"; //$NON-NLS-1$
+    public static final String ACC_ANNOTATION = "ACC_ANNOTATION"; //$NON-NLS-1$
+    public static final String ACC_ENUM = "ACC_ENUM"; //$NON-NLS-1$
+    public static final String ACC_FINAL = "ACC_FINAL"; //$NON-NLS-1$
+    public static final String ACC_INTERFACE = "ACC_INTERFACE"; //$NON-NLS-1$
+    public static final String ACC_NATIVE = "ACC_NATIVE"; //$NON-NLS-1$
+    public static final String ACC_PRIVATE = "ACC_PRIVATE"; //$NON-NLS-1$
+    public static final String ACC_PROTECTED = "ACC_PROTECTED"; //$NON-NLS-1$
+    public static final String ACC_PUBLIC = "ACC_PUBLIC"; //$NON-NLS-1$
+    public static final String ACC_STATIC = "ACC_STATIC"; //$NON-NLS-1$
+    public static final String ACC_STRICT = "ACC_STRICT"; //$NON-NLS-1$
+    public static final String ACC_SYNCHRONIZED = "ACC_SYNCHRONIZED"; //$NON-NLS-1$
+    public static final String ACC_SYNTHETIC = "ACC_SYNTHETIC"; //$NON-NLS-1$
+    public static final String ACC_TRANSIENT = "ACC_TRANSIENT"; //$NON-NLS-1$
+    public static final String ACC_VOLATILE = "ACC_VOLATILE"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_ANNOTATION_DEFAULT = "AnnotationDefault"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_CLASS_FILE_VERSION = "class-file version"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_CODE = "Code"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_CONSTANT_VALUE = "ConstantValue"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_DEPRECATED = "Deprecated"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_ENCLOSING_METHOD = "EnclosingMethod"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_EXCEPTIONS = "Exceptions"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_INNER_CLASSES = "InnerClasses"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_LINE_NUMBER_TABLE = "LineNumberTable"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_LOCAL_VARIABLE_TABLE = "LocalVariableTable"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_LOCAL_VARIABLE_TYPE_TABLE = "LocalVariableTypeTable"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_RUNTIME_INVISIBLE_ANNOTATIONS = "RuntimeInvisibleAnnotations"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = "RuntimeInvisibleParameterAnnotations"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_RUNTIME_VISIBLE_ANNOTATIONS = "RuntimeVisibleAnnotations"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = "RuntimeVisibleParameterAnnotations"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_SIGNATURE = "Signature"; //$NON-NLS-1$
+    public static final String ATTRIBUTE_SOURCE_FILE = "SourceFile"; //$NON-NLS-1$
+    public static final int CONTEXT_CLASS = 0;
+    public static final int CONTEXT_CODE = 3;
+    public static final int CONTEXT_FIELD = 1;
+    public static final int CONTEXT_METHOD = 2;
+    public static final String[] contextNames = { "Class", "Field", "Method", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+            "Code", }; //$NON-NLS-1$
+
+    private static Object getValue(String layout, long value,
+            SegmentConstantPool pool) throws Pack200Exception {
+        if (layout.startsWith("R")) { //$NON-NLS-1$
+            // references
+            if (layout.indexOf('N') != -1)
+                value--;
+            if (layout.startsWith("RU")) { //$NON-NLS-1$
+                return pool.getValue(SegmentConstantPool.UTF_8, value);
+            } else if (layout.startsWith("RS")) { //$NON-NLS-1$
+                return pool.getValue(SegmentConstantPool.SIGNATURE, value);
+            }
+        } else if (layout.startsWith("K")) { //$NON-NLS-1$
+            char type = layout.charAt(1);
+            switch (type) {
+            case 'S': // String
+                return pool.getValue(SegmentConstantPool.CP_STRING, value);
+            case 'I': // Int (or byte or short)
+            case 'C': // Char
+                return pool.getValue(SegmentConstantPool.CP_INT, value);
+            case 'F': // Float
+                return pool.getValue(SegmentConstantPool.CP_FLOAT, value);
+            case 'J': // Long
+                return pool.getValue(SegmentConstantPool.CP_LONG, value);
+            case 'D': // Double
+                return pool.getValue(SegmentConstantPool.CP_DOUBLE, value);
+            }
+        }
+        throw new Pack200Exception("Unknown layout encoding: " + layout);
+    }
 
     private final int context;
 
     private final int index;
 
-	private final String layout;
+    private final String layout;
 
-	private long mask;
+    private long mask;
 
     private final String name;
     private final boolean isDefault;
     private int backwardsCallCount;
 
-
     /**
-     * Construct a default AttributeLayout
-     *  (equivalent to <code>new AttributeLayout(name, context, layout, index, true);</code>)
+     * Construct a default AttributeLayout (equivalent to
+     * <code>new AttributeLayout(name, context, layout, index, true);</code>)
+     * 
      * @param name
      * @param context
      * @param layout
      * @param index
      * @throws Pack200Exception
      */
-	public AttributeLayout(String name, int context, String layout, int index)
-			throws Pack200Exception {
-		this(name, context, layout, index, true);
-	}
+    public AttributeLayout(String name, int context, String layout, int index)
+            throws Pack200Exception {
+        this(name, context, layout, index, true);
+    }
 
     public AttributeLayout(String name, int context, String layout, int index,
             boolean isDefault) throws Pack200Exception {
@@ -142,113 +141,115 @@
         this.isDefault = isDefault;
     }
 
-
-	public boolean equals(Object obj) {
-		if (this == obj)
-			return true;
-		if (obj == null)
-			return false;
-		if (getClass() != obj.getClass())
-			return false;
-		final AttributeLayout other = (AttributeLayout) obj;
-		if (layout == null) {
-			if (other.layout != null)
-				return false;
-		} else if (!layout.equals(other.layout))
-			return false;
-        if(index != other.index)
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        final AttributeLayout other = (AttributeLayout) obj;
+        if (layout == null) {
+            if (other.layout != null)
+                return false;
+        } else if (!layout.equals(other.layout))
             return false;
-        if(context != other.context)
+        if (index != other.index)
+            return false;
+        if (context != other.context)
             return false;
         if (name == null) {
             if (other.name != null)
                 return false;
         } else if (!name.equals(other.name))
             return false;
-		return true;
-	}
+        return true;
+    }
 
-	public Codec getCodec() {
-		if (layout.indexOf("O") >= 0) { //$NON-NLS-1$
-			return Codec.BRANCH5;
-		} else if (layout.indexOf("P") >= 0) { //$NON-NLS-1$
-			return Codec.BCI5;
-		} else if (layout.indexOf("S") >= 0 && layout.indexOf("KS") < 0 //$NON-NLS-1$ //$NON-NLS-2$
-				&& layout.indexOf("RS") < 0) { //$NON-NLS-1$
-			return Codec.SIGNED5;
-		} else if (layout.indexOf("B") >= 0) { //$NON-NLS-1$
-			return Codec.BYTE1;
-		} else {
-			return Codec.UNSIGNED5;
-		}
-	}
-
-	public String getLayout() {
-		return layout;
-	}
-
-	public Object getValue(long value, SegmentConstantPool pool) throws Pack200Exception {
-		return getValue(layout, value, pool);
-	}
-
-	public Object getValue(long value, String type, SegmentConstantPool pool)
-			throws Pack200Exception {
-		// TODO This really needs to be better tested, esp. the different types
-		// TODO This should have the ability to deal with RUN stuff too, and
-		// unions
-		if (layout.startsWith("KQ")) { //$NON-NLS-1$
-			if (type.equals("Ljava/lang/String;")) { //$NON-NLS-1$
-				Object value2 = getValue("KS", value, pool); //$NON-NLS-1$
-				return value2;
-			} else {
-				return getValue("K" + type + layout.substring(2), value, //$NON-NLS-1$
-						pool);
-			}
-		} else {
-			return getValue(layout, value, pool);
-		}
-	}
+    public Codec getCodec() {
+        if (layout.indexOf("O") >= 0) { //$NON-NLS-1$
+            return Codec.BRANCH5;
+        } else if (layout.indexOf("P") >= 0) { //$NON-NLS-1$
+            return Codec.BCI5;
+        } else if (layout.indexOf("S") >= 0 && layout.indexOf("KS") < 0 //$NON-NLS-1$ //$NON-NLS-2$
+                && layout.indexOf("RS") < 0) { //$NON-NLS-1$
+            return Codec.SIGNED5;
+        } else if (layout.indexOf("B") >= 0) { //$NON-NLS-1$
+            return Codec.BYTE1;
+        } else {
+            return Codec.UNSIGNED5;
+        }
+    }
+
+    public String getLayout() {
+        return layout;
+    }
+
+    public Object getValue(long value, SegmentConstantPool pool)
+            throws Pack200Exception {
+        return getValue(layout, value, pool);
+    }
 
-	public int hashCode() {
+    public Object getValue(long value, String type, SegmentConstantPool pool)
+            throws Pack200Exception {
+        // TODO This really needs to be better tested, esp. the different types
+        // TODO This should have the ability to deal with RUN stuff too, and
+        // unions
+        if (layout.startsWith("KQ")) { //$NON-NLS-1$
+            if (type.equals("Ljava/lang/String;")) { //$NON-NLS-1$
+                Object value2 = getValue("KS", value, pool); //$NON-NLS-1$
+                return value2;
+            } else {
+                return getValue("K" + type + layout.substring(2), value, //$NON-NLS-1$
+                        pool);
+            }
+        } else {
+            return getValue(layout, value, pool);
+        }
+    }
+
+    public int hashCode() {
         int PRIME = 31;
         int r = 1;
-        if(name != null) {
+        if (name != null) {
             r = r * PRIME + name.hashCode();
         }
-		if(layout != null) {
-            r = r* PRIME + layout.hashCode();
+        if (layout != null) {
+            r = r * PRIME + layout.hashCode();
         }
         r = r * PRIME + index;
         r = r * PRIME + context;
         return r;
-	}
+    }
 
-	public boolean isClass() {
-		return context == CONTEXT_CLASS;
-	}
-
-	public boolean isCode() {
-		return context == CONTEXT_CODE;
-	}
-
-	public boolean isField() {
-		return context == CONTEXT_FIELD;
-	}
-
-	public boolean isMethod() {
-		return context == CONTEXT_METHOD;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.apache.harmony.pack200.IMatches#matches(long)
-	 */
-	public boolean matches(long value) {
-		return (value & mask) != 0;
-	}
+    public boolean isClass() {
+        return context == CONTEXT_CLASS;
+    }
+
+    public boolean isCode() {
+        return context == CONTEXT_CODE;
+    }
 
-	public String toString() {
+    public boolean isField() {
+        return context == CONTEXT_FIELD;
+    }
+
+    public boolean isMethod() {
+        return context == CONTEXT_METHOD;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.harmony.pack200.IMatches#matches(long)
+     */
+    public boolean matches(long value) {
+        return (value & mask) != 0;
+    }
+
+    public String toString() {
         return contextNames[context] + ": " + name;
-	}
+    }
 
     public int getContext() {
         return context;
@@ -263,13 +264,12 @@
     }
 
     public int numBackwardsCallables() {
-        if(layout == "*") {
+        if (layout == "*") {
             return 1;
         } else {
             return backwardsCallCount;
         }
     }
-
 
     public boolean isDefaultLayout() {
         return isDefault;

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java Fri Apr 11 03:09:38 2008
@@ -197,9 +197,11 @@
     private final Map methodLayouts = new HashMap();
     private final Map codeLayouts = new HashMap();
 
-    // The order of the maps in this array should not be changed as their indices correspond to
+    // The order of the maps in this array should not be changed as their
+    // indices correspond to
     // the value of their context constants (AttributeLayout.CONTEXT_CLASS etc.)
-    private final Map[] layouts = new Map[] {classLayouts, fieldLayouts, methodLayouts, codeLayouts};
+    private final Map[] layouts = new Map[] { classLayouts, fieldLayouts,
+            methodLayouts, codeLayouts };
 
     private final Map layoutsToBands = new HashMap();
 
@@ -211,11 +213,10 @@
     }
 
     public void add(AttributeLayout layout) {
-        layouts[layout.getContext()].put(new Integer(layout.getIndex()), layout);
+        layouts[layout.getContext()]
+                .put(new Integer(layout.getIndex()), layout);
     }
 
-
-
     public void add(AttributeLayout layout, NewAttributeBands newBands) {
         add(layout);
         layoutsToBands.put(layout, newBands);
@@ -226,7 +227,7 @@
         Map map = layouts[context];
         for (Iterator iter = map.values().iterator(); iter.hasNext();) {
             AttributeLayout layout = (AttributeLayout) iter.next();
-            if(layout.getName().equals(name)) {
+            if (layout.getName().equals(name)) {
                 return layout;
             }
         }
@@ -242,24 +243,24 @@
     /**
      * The map should not contain the same layout and name combination more than
      * once for each context.
+     * 
      * @throws Pack200Exception
-     *
+     * 
      */
     public void checkMap() throws Pack200Exception {
         for (int i = 0; i < layouts.length; i++) {
             Map map = layouts[i];
             Collection c = map.values();
-            if(!(c instanceof List)) {
+            if (!(c instanceof List)) {
                 c = new ArrayList(c);
             }
-            List l = (List)c;
+            List l = (List) c;
             for (int j = 0; j < l.size(); j++) {
                 AttributeLayout layout1 = (AttributeLayout) l.get(j);
                 for (int j2 = j + 1; j2 < l.size(); j2++) {
                     AttributeLayout layout2 = (AttributeLayout) l.get(j2);
                     if (layout1.getName().equals(layout2.getName())
-                            && layout1.getLayout().equals(
-                                    layout2.getLayout())) {
+                            && layout1.getLayout().equals(layout2.getLayout())) {
                         throw new Pack200Exception(
                                 "Same layout/name combination: "
                                         + layout1.getLayout()

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java Fri Apr 11 03:09:38 2008
@@ -24,17 +24,17 @@
 
 /**
  * A BHSD codec is a means of encoding integer values as a sequence of bytes or
- * vice versa using a specified "BHSD" encoding mechanism. It uses a variable-length encoding and a modified sign representation
- * such that small numbers are represented as a single byte, whilst larger
- * numbers take more bytes to encode. The number may be signed or unsigned; if
- * it is unsigned, it can be weighted towards positive numbers or equally
- * distributed using a one's complement. The Codec also supports delta coding,
- * where a sequence of numbers is represented as a series of first-order
- * differences. So a delta encoding of the integers [1..10] would be represented
- * as a sequence of 10x1s. This allows the absolute value of a coded integer to
- * fall outside of the 'small number' range, whilst still being encoded as a
- * single byte.
- *
+ * vice versa using a specified "BHSD" encoding mechanism. It uses a
+ * variable-length encoding and a modified sign representation such that small
+ * numbers are represented as a single byte, whilst larger numbers take more
+ * bytes to encode. The number may be signed or unsigned; if it is unsigned, it
+ * can be weighted towards positive numbers or equally distributed using a one's
+ * complement. The Codec also supports delta coding, where a sequence of numbers
+ * is represented as a series of first-order differences. So a delta encoding of
+ * the integers [1..10] would be represented as a sequence of 10x1s. This allows
+ * the absolute value of a coded integer to fall outside of the 'small number'
+ * range, whilst still being encoded as a single byte.
+ * 
  * A BHSD codec is configured with four parameters:
  * <dl>
  * <dt>B</dt>
@@ -67,7 +67,7 @@
  * instance of the Codec to be cloned for each use.)
  * <dt>
  * </dl>
- *
+ * 
  * Codecs are notated as (B,H,S,D) and either D or S,D may be omitted if zero.
  * Thus {@link #BYTE1} is denoted (1,256,0,0) or (1,256). The
  * {@link #toString()} method prints out the condensed form of the encoding.
@@ -76,34 +76,34 @@
  * {@link #UNSIGNED5}) are unsigned; otherwise, in most cases, they are signed.
  * The presence of the word Delta ({@link #DELTA5}, {@link #UDELTA5})
  * indicates a delta encoding is used.
- *
+ * 
  */
 public final class BHSDCodec extends Codec {
 
-	/**
-	 * The maximum number of bytes in each coding word
-	 */
-	private final int b;
-
-	/**
-	 * Whether delta encoding is used (0=false,1=true)
-	 */
-	private final int d;
-
-	/**
-	 * The radix of the encoding
-	 */
-	private final int h;
-
-	/**
-	 * The co-parameter of h; h-256
-	 */
-	private final int l;
-
-	/**
-	 * Represents signed numbers or not (0=unsigned,1/2=signed)
-	 */
-	private final int s;
+    /**
+     * The maximum number of bytes in each coding word
+     */
+    private final int b;
+
+    /**
+     * Whether delta encoding is used (0=false,1=true)
+     */
+    private final int d;
+
+    /**
+     * The radix of the encoding
+     */
+    private final int h;
+
+    /**
+     * The co-parameter of h; h-256
+     */
+    private final int l;
+
+    /**
+     * Represents signed numbers or not (0=unsigned,1/2=signed)
+     */
+    private final int s;
 
     private long cardinality;
 
@@ -111,108 +111,107 @@
 
     private final long largest;
 
-	/**
-	 * Constructs an unsigned, non-delta Codec with the given B and H values.
-	 *
-	 * @param b
-	 *            the maximum number of bytes that a value can be encoded as
-	 *            [1..5]
-	 * @param h
-	 *            the radix of the encoding [1..256]
-	 */
-	public BHSDCodec(int b, int h) {
-		this(b, h, 0);
-	}
-
-	/**
-	 * Constructs a non-delta Codec with the given B, H and S values.
-	 *
-	 * @param b
-	 *            the maximum number of bytes that a value can be encoded as
-	 *            [1..5]
-	 * @param h
-	 *            the radix of the encoding [1..256]
-	 * @param s
-	 *            whether the encoding represents signed numbers (s=0 is
-	 *            unsigned; s=1 is signed with 1s complement; s=2 is signed with ?)
-	 */
-	public BHSDCodec(int b, int h, int s) {
-		this(b, h, s, 0);
-	}
-
-	/**
-	 * Constructs a Codec with the given B, H, S and D values.
-	 *
-	 * @param b
-	 *            the maximum number of bytes that a value can be encoded as
-	 *            [1..5]
-	 * @param h
-	 *            the radix of the encoding [1..256]
-	 * @param s
-	 *            whether the encoding represents signed numbers (s=0 is
-	 *            unsigned; s=1 is signed with 1s complement; s=2 is signed with ?)
-	 * @param d
-	 *            whether this is a delta encoding (d=0 is non-delta; d=1 is
-	 *            delta)
-	 */
-	public BHSDCodec(int b, int h, int s, int d) {
-		if (b < 1 || b > 5)
-			throw new IllegalArgumentException("1<=b<=5");
-		if (h < 1 || h > 256)
-			throw new IllegalArgumentException("1<=h<=256");
-		if (s < 0 || s > 2)
-			throw new IllegalArgumentException("0<=s<=2");
-		if (d < 0 || d > 1)
-			throw new IllegalArgumentException("0<=d<=1");
-		if (b == 1 && h != 256)
-			throw new IllegalArgumentException("b=1 -> h=256");
-		if (h == 256 && b == 5)
-			throw new IllegalArgumentException("h=256 -> b!=5");
-		this.b = b;
-		this.h = h;
-		this.s = s;
-		this.d = d;
-		this.l = 256 - h;
-        if(h == 1) {
+    /**
+     * Constructs an unsigned, non-delta Codec with the given B and H values.
+     * 
+     * @param b
+     *            the maximum number of bytes that a value can be encoded as
+     *            [1..5]
+     * @param h
+     *            the radix of the encoding [1..256]
+     */
+    public BHSDCodec(int b, int h) {
+        this(b, h, 0);
+    }
+
+    /**
+     * Constructs a non-delta Codec with the given B, H and S values.
+     * 
+     * @param b
+     *            the maximum number of bytes that a value can be encoded as
+     *            [1..5]
+     * @param h
+     *            the radix of the encoding [1..256]
+     * @param s
+     *            whether the encoding represents signed numbers (s=0 is
+     *            unsigned; s=1 is signed with 1s complement; s=2 is signed with ?)
+     */
+    public BHSDCodec(int b, int h, int s) {
+        this(b, h, s, 0);
+    }
+
+    /**
+     * Constructs a Codec with the given B, H, S and D values.
+     * 
+     * @param b
+     *            the maximum number of bytes that a value can be encoded as
+     *            [1..5]
+     * @param h
+     *            the radix of the encoding [1..256]
+     * @param s
+     *            whether the encoding represents signed numbers (s=0 is
+     *            unsigned; s=1 is signed with 1s complement; s=2 is signed with ?)
+     * @param d
+     *            whether this is a delta encoding (d=0 is non-delta; d=1 is
+     *            delta)
+     */
+    public BHSDCodec(int b, int h, int s, int d) {
+        if (b < 1 || b > 5)
+            throw new IllegalArgumentException("1<=b<=5");
+        if (h < 1 || h > 256)
+            throw new IllegalArgumentException("1<=h<=256");
+        if (s < 0 || s > 2)
+            throw new IllegalArgumentException("0<=s<=2");
+        if (d < 0 || d > 1)
+            throw new IllegalArgumentException("0<=d<=1");
+        if (b == 1 && h != 256)
+            throw new IllegalArgumentException("b=1 -> h=256");
+        if (h == 256 && b == 5)
+            throw new IllegalArgumentException("h=256 -> b!=5");
+        this.b = b;
+        this.h = h;
+        this.s = s;
+        this.d = d;
+        this.l = 256 - h;
+        if (h == 1) {
             cardinality = b * 255 + 1;
         } else {
-            cardinality = (long) ((long)(l * (1-Math.pow(h, b))/(1-h)) + Math.pow(h,b));
+            cardinality = (long) ((long) (l * (1 - Math.pow(h, b)) / (1 - h)) + Math
+                    .pow(h, b));
         }
         smallest = calculateSmallest();
         largest = calculateLargest();
-	}
+    }
+
+    /**
+     * Returns the cardinality of this codec; that is, the number of distinct
+     * values that it can contain.
+     * 
+     * @return the cardinality of this codec
+     */
+    public long cardinality() {
+        return cardinality;
+    }
 
-	/**
-	 * Returns the cardinality of this codec; that is, the number of distinct
-	 * values that it can contain.
-	 *
-	 * @return the cardinality of this codec
-	 */
-	public long cardinality() {
-		return cardinality;
-	}
-
-
-	public long decode(InputStream in) throws IOException, Pack200Exception {
-		if (d != 0)
-			throw new Pack200Exception(
-					"Delta encoding used without passing in last value; this is a coding error");
-		return decode(in, 0);
-	}
-
-
-	public long decode(InputStream in, long last) throws IOException,
-			Pack200Exception {
-		int n = 0;
-		long z = 0;
-		long x;
-		do {
-			x = in.read();
-			if (x == -1)
-				throw new EOFException("End of stream reached whilst decoding");
-			z += x * Math.pow(h, n);
+    public long decode(InputStream in) throws IOException, Pack200Exception {
+        if (d != 0)
+            throw new Pack200Exception(
+                    "Delta encoding used without passing in last value; this is a coding error");
+        return decode(in, 0);
+    }
+
+    public long decode(InputStream in, long last) throws IOException,
+            Pack200Exception {
+        int n = 0;
+        long z = 0;
+        long x;
+        do {
+            x = in.read();
+            if (x == -1)
+                throw new EOFException("End of stream reached whilst decoding");
+            z += x * Math.pow(h, n);
             n++;
-		} while (n < b & isHigh(x));
+        } while (n < b & isHigh(x));
 
         if (isSigned()) {
             int u = ((1 << s) - 1);
@@ -222,45 +221,47 @@
                 z = z - (z >>> s);
             }
         }
-// This algorithm does the same thing, but is probably slower.  Leaving in for now for readability
-//        if(isSigned()) {
-//            long u = z;
-//            long twoPowS = (long)Math.pow(2, s);
-//            double twoPowSMinusOne = twoPowS-1;
-//            if(u % twoPowS < twoPowSMinusOne) {
-//                if(cardinality < Math.pow(2, 32)) {
-//                    z = (long) (u - (Math.floor(u/ twoPowS)));
-//                } else {
-//                    z = cast32((long) (u - (Math.floor(u/ twoPowS))));
-//                }
-//            } else {
-//                z = (long) (-Math.floor(u/ twoPowS) - 1);
-//            }
-//        }
-	    if (isDelta())
-	        z += last;
-		return z;
-	}
-
-//	private long cast32(long u) {
-//        u = (long) ((long) ((u + Math.pow(2, 31)) % Math.pow(2, 32)) - Math.pow(2, 31));
-//        return u;
-//    }
+        // This algorithm does the same thing, but is probably slower. Leaving
+        // in for now for readability
+        // if(isSigned()) {
+        // long u = z;
+        // long twoPowS = (long)Math.pow(2, s);
+        // double twoPowSMinusOne = twoPowS-1;
+        // if(u % twoPowS < twoPowSMinusOne) {
+        // if(cardinality < Math.pow(2, 32)) {
+        // z = (long) (u - (Math.floor(u/ twoPowS)));
+        // } else {
+        // z = cast32((long) (u - (Math.floor(u/ twoPowS))));
+        // }
+        // } else {
+        // z = (long) (-Math.floor(u/ twoPowS) - 1);
+        // }
+        // }
+        if (isDelta())
+            z += last;
+        return z;
+    }
+
+    // private long cast32(long u) {
+    // u = (long) ((long) ((u + Math.pow(2, 31)) % Math.pow(2, 32)) -
+    // Math.pow(2, 31));
+    // return u;
+    // }
 
     private boolean isHigh(long x) {
-        return x>=l;
+        return x >= l;
     }
 
     /**
-	 * True if this encoding can code the given value
-	 *
-	 * @param value
-	 *            the value to check
-	 * @return <code>true</code> if the encoding can encode this value
-	 */
-	public boolean encodes(long value) {
-		return (value >= smallest && value <= largest);
-	}
+     * True if this encoding can code the given value
+     * 
+     * @param value
+     *            the value to check
+     * @return <code>true</code> if the encoding can encode this value
+     */
+    public boolean encodes(long value) {
+        return (value >= smallest && value <= largest);
+    }
 
     public byte[] encode(long value, long last) throws Pack200Exception {
         if (isDelta()) {
@@ -306,62 +307,65 @@
         return bytes;
     }
 
-	/**
-	 * Returns true if this codec is a delta codec
-	 * @return true if this codec is a delta codec
-	 */
-	public boolean isDelta() {
-		return d != 0;
-	}
-
-	/**
-	 * Returns true if this codec is a signed codec
-	 * @return true if this codec is a signed codec
-	 */
-	public boolean isSigned() {
-		return s != 0;
-	}
-
-	/**
-	 * Returns the largest value that this codec can represent.
-	 *
-	 * @return the largest value that this codec can represent.
-	 */
+    /**
+     * Returns true if this codec is a delta codec
+     * 
+     * @return true if this codec is a delta codec
+     */
+    public boolean isDelta() {
+        return d != 0;
+    }
+
+    /**
+     * Returns true if this codec is a signed codec
+     * 
+     * @return true if this codec is a signed codec
+     */
+    public boolean isSigned() {
+        return s != 0;
+    }
+
+    /**
+     * Returns the largest value that this codec can represent.
+     * 
+     * @return the largest value that this codec can represent.
+     */
     public long largest() {
         return largest;
     }
 
-	private long calculateLargest() {
-		long result;
-		// TODO This can probably be optimized into a better mathematical statement
-        if(d == 1) {
+    private long calculateLargest() {
+        long result;
+        // TODO This can probably be optimized into a better mathematical
+        // statement
+        if (d == 1) {
             BHSDCodec bh0 = new BHSDCodec(b, h);
             return bh0.largest();
         } else if (s == 0) {
-			result = cardinality() - 1;
-		} else if (s == 1) {
-			result = cardinality() / 2 - 1;
-		} else if (s == 2) {
-			result = (3L * cardinality()) / 4 - 1;
-		} else {
-			throw new Error("Unknown s value");
-		}
-		return Math.min((s == 0 ? ((long) Integer.MAX_VALUE) << 1
-				: Integer.MAX_VALUE) - 1, result);
-	}
-
-	/**
-	 * Returns the smallest value that this codec can represent.
-	 *
-	 * @return the smallest value that this codec can represent.
-	 */
+            result = cardinality() - 1;
+        } else if (s == 1) {
+            result = cardinality() / 2 - 1;
+        } else if (s == 2) {
+            result = (3L * cardinality()) / 4 - 1;
+        } else {
+            throw new Error("Unknown s value");
+        }
+        return Math.min((s == 0 ? ((long) Integer.MAX_VALUE) << 1
+                : Integer.MAX_VALUE) - 1, result);
+    }
+
+    /**
+     * Returns the smallest value that this codec can represent.
+     * 
+     * @return the smallest value that this codec can represent.
+     */
     public long smallest() {
         return smallest;
     }
 
-	private long calculateSmallest() {
-		long result;
-         if (d == 1) {
+    private long calculateSmallest() {
+        long result;
+        if (d == 1) {
             BHSDCodec bh0 = new BHSDCodec(b, h);
             return bh0.smallest();
         } else if (isSigned()) {
@@ -373,48 +377,49 @@
                 result = 0;
             }
         }
-		return Math.max(Integer.MIN_VALUE, result);
-	}
-	/**
-	 * Returns the codec in the form (1,256) or (1,64,1,1). Note that trailing
-	 * zero fields are not shown.
-	 */
-	public String toString() {
-		StringBuffer buffer = new StringBuffer(11);
-		buffer.append('(');
-		buffer.append(b);
-		buffer.append(',');
-		buffer.append(h);
-		if (s != 0 || d != 0) {
-			buffer.append(',');
-			buffer.append(s);
-		}
-		if (d != 0) {
-			buffer.append(',');
-			buffer.append(d);
-		}
-		buffer.append(')');
-		return buffer.toString();
-	}
-
-	/**
-	 * @return the b
-	 */
-	public int getB() {
-		return b;
-	}
-
-	/**
-	 * @return the h
-	 */
-	public int getH() {
-		return h;
-	}
-
-	/**
-	 * @return the l
-	 */
-	public int getL() {
-		return l;
-	}
+        return Math.max(Integer.MIN_VALUE, result);
+    }
+
+    /**
+     * Returns the codec in the form (1,256) or (1,64,1,1). Note that trailing
+     * zero fields are not shown.
+     */
+    public String toString() {
+        StringBuffer buffer = new StringBuffer(11);
+        buffer.append('(');
+        buffer.append(b);
+        buffer.append(',');
+        buffer.append(h);
+        if (s != 0 || d != 0) {
+            buffer.append(',');
+            buffer.append(s);
+        }
+        if (d != 0) {
+            buffer.append(',');
+            buffer.append(d);
+        }
+        buffer.append(')');
+        return buffer.toString();
+    }
+
+    /**
+     * @return the b
+     */
+    public int getB() {
+        return b;
+    }
+
+    /**
+     * @return the h
+     */
+    public int getH() {
+        return h;
+    }
+
+    /**
+     * @return the l
+     */
+    public int getL() {
+        return l;
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java Fri Apr 11 03:09:38 2008
@@ -39,7 +39,8 @@
  */
 public abstract class BandSet {
 
-    public abstract void unpack(InputStream inputStream) throws IOException, Pack200Exception;
+    public abstract void unpack(InputStream inputStream) throws IOException,
+            Pack200Exception;
 
     protected Segment segment;
 
@@ -52,7 +53,7 @@
 
     /**
      * Decode a band and return an array of <code>int</code> values
-     *
+     * 
      * @param name
      *            the name of the band (primarily for logging/debugging
      *            purposes)
@@ -70,9 +71,8 @@
      *             if there is a problem decoding the value or that the value is
      *             invalid
      */
-    public int[] decodeBandInt(String name, InputStream in,
-            BHSDCodec codec, int count) throws IOException,
-            Pack200Exception {
+    public int[] decodeBandInt(String name, InputStream in, BHSDCodec codec,
+            int count) throws IOException, Pack200Exception {
         int[] band;
         Codec codecUsed = codec;
         if (codec.getB() == 1 || count == 0) {
@@ -85,21 +85,21 @@
         int first = getFirst[0];
         if (codec.isSigned() && first >= -256 && first <= -1) {
             // Non-default codec should be used
-            codecUsed = CodecEncoding.getCodec((-1 - first),
-                    header.getBandHeadersInputStream(), codec);
+            codecUsed = CodecEncoding.getCodec((-1 - first), header
+                    .getBandHeadersInputStream(), codec);
             band = codecUsed.decodeInts(count, in);
         } else if (!codec.isSigned() && first >= codec.getL()
                 && first <= codec.getL() + 255) {
             // Non-default codec should be used
-            codecUsed = CodecEncoding.getCodec(first
-                    - codec.getL(), header.getBandHeadersInputStream(), codec);
+            codecUsed = CodecEncoding.getCodec(first - codec.getL(), header
+                    .getBandHeadersInputStream(), codec);
             band = codecUsed.decodeInts(count, in);
         } else {
             // First element should not be discarded
             band = codec.decodeInts(count - 1, in, first);
         }
-        if(codecUsed instanceof BHSDCodec && ((BHSDCodec)codecUsed).isDelta()) {
-            BHSDCodec bhsd = (BHSDCodec)codecUsed;
+        if (codecUsed instanceof BHSDCodec && ((BHSDCodec) codecUsed).isDelta()) {
+            BHSDCodec bhsd = (BHSDCodec) codecUsed;
             long cardinality = bhsd.cardinality();
             for (int i = 0; i < band.length; i++) {
                 while (band[i] > bhsd.largest()) {
@@ -114,12 +114,12 @@
             long[] favoured = (long[]) popCodec.getFavoured().clone();
             Arrays.sort(favoured);
             for (int i = 0; i < band.length; i++) {
-                boolean favouredValue = Arrays.binarySearch(favoured,
-                        band[i]) > -1;
-                Codec theCodec = favouredValue ? popCodec
-                        .getFavouredCodec() : popCodec.getUnvafouredCodec();
-                if (theCodec instanceof BHSDCodec && ((BHSDCodec) theCodec).isDelta()) {
-                    BHSDCodec bhsd = (BHSDCodec)theCodec;
+                boolean favouredValue = Arrays.binarySearch(favoured, band[i]) > -1;
+                Codec theCodec = favouredValue ? popCodec.getFavouredCodec()
+                        : popCodec.getUnvafouredCodec();
+                if (theCodec instanceof BHSDCodec
+                        && ((BHSDCodec) theCodec).isDelta()) {
+                    BHSDCodec bhsd = (BHSDCodec) theCodec;
                     long cardinality = bhsd.cardinality();
                     while (band[i] > bhsd.largest()) {
                         band[i] -= cardinality;
@@ -135,7 +135,7 @@
 
     /**
      * Decode a band and return an array of <code>int[]</code> values
-     *
+     * 
      * @param name
      *            the name of the band (primarily for logging/debugging
      *            purposes)
@@ -155,8 +155,8 @@
      *             invalid
      */
     public int[][] decodeBandInt(String name, InputStream in,
-            BHSDCodec defaultCodec, int[] counts)
-            throws IOException, Pack200Exception {
+            BHSDCodec defaultCodec, int[] counts) throws IOException,
+            Pack200Exception {
         int[][] result = new int[counts.length][];
         int totalCount = 0;
         for (int i = 0; i < counts.length; i++) {
@@ -166,7 +166,7 @@
         int index = 0;
         for (int i = 0; i < result.length; i++) {
             result[i] = new int[counts[i]];
-            for(int j = 0; j < result[i].length; j++) {
+            for (int j = 0; j < result[i].length; j++) {
                 result[i][j] = twoDResult[index];
                 index++;
             }
@@ -176,7 +176,7 @@
 
     /**
      * Decode a band and return an array of <code>long</code> values
-     *
+     * 
      * @param name
      *            the name of the band (primarily for logging/debugging
      *            purposes)
@@ -208,22 +208,22 @@
         long first = getFirst[0];
         if (codec.isSigned() && first >= -256 && first <= -1) {
             // Non-default codec should be used
-            codecUsed = CodecEncoding.getCodec((int) (-1 - first),
-                    header.getBandHeadersInputStream(), codec);
+            codecUsed = CodecEncoding.getCodec((int) (-1 - first), header
+                    .getBandHeadersInputStream(), codec);
             band = codecUsed.decode(count, in);
         } else if (!codec.isSigned() && first >= codec.getL()
                 && first <= codec.getL() + 255) {
             // Non-default codec should be used
-            codecUsed = CodecEncoding.getCodec((int) first
-                    - codec.getL(), header.getBandHeadersInputStream(), codec);
+            codecUsed = CodecEncoding.getCodec((int) first - codec.getL(),
+                    header.getBandHeadersInputStream(), codec);
             band = codecUsed.decode(count, in);
         } else {
             // First element should not be discarded
             band = codec.decode(count - 1, in, first);
         }
 
-        if(codecUsed instanceof BHSDCodec && ((BHSDCodec)codecUsed).isDelta()) {
-            BHSDCodec bhsd = (BHSDCodec)codecUsed;
+        if (codecUsed instanceof BHSDCodec && ((BHSDCodec) codecUsed).isDelta()) {
+            BHSDCodec bhsd = (BHSDCodec) codecUsed;
             long cardinality = bhsd.cardinality();
             for (int i = 0; i < band.length; i++) {
                 while (band[i] > bhsd.largest()) {
@@ -238,12 +238,12 @@
             long[] favoured = (long[]) popCodec.getFavoured().clone();
             Arrays.sort(favoured);
             for (int i = 0; i < band.length; i++) {
-                boolean favouredValue = Arrays.binarySearch(favoured,
-                        band[i]) > -1;
-                Codec theCodec = favouredValue ? popCodec
-                        .getFavouredCodec() : popCodec.getUnvafouredCodec();
-                if (theCodec instanceof BHSDCodec && ((BHSDCodec) theCodec).isDelta()) {
-                    BHSDCodec bhsd = (BHSDCodec)theCodec;
+                boolean favouredValue = Arrays.binarySearch(favoured, band[i]) > -1;
+                Codec theCodec = favouredValue ? popCodec.getFavouredCodec()
+                        : popCodec.getUnvafouredCodec();
+                if (theCodec instanceof BHSDCodec
+                        && ((BHSDCodec) theCodec).isDelta()) {
+                    BHSDCodec bhsd = (BHSDCodec) theCodec;
                     long cardinality = bhsd.cardinality();
                     while (band[i] > bhsd.largest()) {
                         band[i] -= cardinality;
@@ -257,10 +257,11 @@
         return band;
     }
 
-    public byte[] encodeBandLong(long[] data, BHSDCodec codec) throws IOException, Pack200Exception {
+    public byte[] encodeBandLong(long[] data, BHSDCodec codec)
+            throws IOException, Pack200Exception {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         for (int i = 0; i < data.length; i++) {
-            baos.write(codec.encode(data[i], i == 0 ? 0 : data[i-1]));
+            baos.write(codec.encode(data[i], i == 0 ? 0 : data[i - 1]));
         }
         return baos.toByteArray();
     }
@@ -299,7 +300,7 @@
         }
         int[] hi = null;
         int[] lo;
-        if(hiCodec != null) {
+        if (hiCodec != null) {
             hi = decodeBandInt(name, in, hiCodec, sum);
             lo = decodeBandInt(name, in, loCodec, sum);
         } else {
@@ -309,8 +310,9 @@
         int index = 0;
         for (int i = 0; i < result.length; i++) {
             for (int j = 0; j < result[i].length; j++) {
-                if(hi != null) {
-                    result[i][j] = ((long)hi[index] << 32) | (lo[index] & 4294967295L);
+                if (hi != null) {
+                    result[i][j] = ((long) hi[index] << 32)
+                            | (lo[index] & 4294967295L);
                 } else {
                     result[i][j] = lo[index];
                 }
@@ -326,7 +328,7 @@
      * <code>reference</code> (which is populated prior to this call). An
      * exception is thrown if a decoded index falls outside the range
      * [0..reference.length-1].
-     *
+     * 
      * @param name
      *            the band name
      * @param in
@@ -337,7 +339,7 @@
      *            the number of references to decode
      * @param reference
      *            the array of values to use for the references
-     *
+     * 
      * @throws IOException
      *             if a problem occurs during reading from the underlying stream
      * @throws Pack200Exception
@@ -347,8 +349,7 @@
     public String[] parseReferences(String name, InputStream in,
             BHSDCodec codec, int count, String[] reference) throws IOException,
             Pack200Exception {
-        return parseReferences(name, in, codec, new int[] { count },
-                reference)[0];
+        return parseReferences(name, in, codec, new int[] { count }, reference)[0];
     }
 
     /**
@@ -358,7 +359,7 @@
      * exception is thrown if a decoded index falls outside the range
      * [0..reference.length-1]. Unlike the other parseReferences, this
      * post-processes the result into an array of results.
-     *
+     * 
      * @param name
      *            TODO
      * @param in
@@ -369,7 +370,7 @@
      *            the numbers of references to decode for each array entry
      * @param reference
      *            the array of values to use for the references
-     *
+     * 
      * @throws IOException
      *             if a problem occurs during reading from the underlying stream
      * @throws Pack200Exception
@@ -396,7 +397,8 @@
             int index = indices[i1];
             if (index < 0 || index >= reference.length)
                 throw new Pack200Exception(
-                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
+                        "Something has gone wrong during parsing references, index = "
+                                + index + ", array size = " + reference.length);
             result1[i1] = reference[index];
         }
         String[] refs = result1;
@@ -411,7 +413,8 @@
         return result;
     }
 
-    public CPInteger[] parseCPIntReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
+    public CPInteger[] parseCPIntReferences(String name, InputStream in,
+            BHSDCodec codec, int count) throws IOException, Pack200Exception {
         int[] reference = segment.getCpBands().getCpInt();
         int[] indices = decodeBandInt(name, in, codec, count);
         CPInteger[] result = new CPInteger[indices.length];
@@ -419,13 +422,16 @@
             int index = indices[i1];
             if (index < 0 || index >= reference.length)
                 throw new Pack200Exception(
-                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
-            result[i1] = segment.getCpBands().cpIntegerValue(new Integer(reference[index]));
+                        "Something has gone wrong during parsing references, index = "
+                                + index + ", array size = " + reference.length);
+            result[i1] = segment.getCpBands().cpIntegerValue(
+                    new Integer(reference[index]));
         }
         return result;
     }
 
-    public CPDouble[] parseCPDoubleReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
+    public CPDouble[] parseCPDoubleReferences(String name, InputStream in,
+            BHSDCodec codec, int count) throws IOException, Pack200Exception {
         double[] reference = segment.getCpBands().getCpDouble();
         int[] indices = decodeBandInt(name, in, codec, count);
         CPDouble[] result = new CPDouble[indices.length];
@@ -433,13 +439,16 @@
             int index = indices[i1];
             if (index < 0 || index >= reference.length)
                 throw new Pack200Exception(
-                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
-            result[i1] = segment.getCpBands().cpDoubleValue(new Double(reference[index]));
+                        "Something has gone wrong during parsing references, index = "
+                                + index + ", array size = " + reference.length);
+            result[i1] = segment.getCpBands().cpDoubleValue(
+                    new Double(reference[index]));
         }
         return result;
     }
 
-    public CPFloat[] parseCPFloatReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
+    public CPFloat[] parseCPFloatReferences(String name, InputStream in,
+            BHSDCodec codec, int count) throws IOException, Pack200Exception {
         float[] reference = segment.getCpBands().getCpFloat();
         int[] indices = decodeBandInt(name, in, codec, count);
         CPFloat[] result = new CPFloat[indices.length];
@@ -447,13 +456,16 @@
             int index = indices[i1];
             if (index < 0 || index >= reference.length)
                 throw new Pack200Exception(
-                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
-            result[i1] = segment.getCpBands().cpFloatValue(new Float(reference[index]));
+                        "Something has gone wrong during parsing references, index = "
+                                + index + ", array size = " + reference.length);
+            result[i1] = segment.getCpBands().cpFloatValue(
+                    new Float(reference[index]));
         }
         return result;
     }
 
-    public CPLong[] parseCPLongReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
+    public CPLong[] parseCPLongReferences(String name, InputStream in,
+            BHSDCodec codec, int count) throws IOException, Pack200Exception {
         long[] reference = segment.getCpBands().getCpLong();
         int[] indices = decodeBandInt(name, in, codec, count);
         CPLong[] result = new CPLong[indices.length];
@@ -461,13 +473,16 @@
             int index = indices[i1];
             if (index < 0 || index >= reference.length)
                 throw new Pack200Exception(
-                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
-            result[i1] = segment.getCpBands().cpLongValue(new Long(reference[index]));
+                        "Something has gone wrong during parsing references, index = "
+                                + index + ", array size = " + reference.length);
+            result[i1] = segment.getCpBands().cpLongValue(
+                    new Long(reference[index]));
         }
         return result;
     }
 
-    public CPUTF8[] parseCPUTF8References(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
+    public CPUTF8[] parseCPUTF8References(String name, InputStream in,
+            BHSDCodec codec, int count) throws IOException, Pack200Exception {
         String[] reference = segment.getCpBands().getCpUTF8();
         int[] indices = decodeBandInt(name, in, codec, count);
         CPUTF8[] result = new CPUTF8[indices.length];
@@ -475,14 +490,16 @@
             int index = indices[i1];
             if (index < 0 || index >= reference.length)
                 throw new Pack200Exception(
-                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
-            result[i1] = segment.getCpBands().cpUTF8Value(reference[index], ClassConstantPool.DOMAIN_NORMALASCIIZ);
+                        "Something has gone wrong during parsing references, index = "
+                                + index + ", array size = " + reference.length);
+            result[i1] = segment.getCpBands().cpUTF8Value(reference[index],
+                    ClassConstantPool.DOMAIN_NORMALASCIIZ);
         }
         return result;
     }
 
-
-    public CPUTF8[][] parseCPUTF8References(String name, InputStream in, BHSDCodec codec, int[] counts) throws IOException, Pack200Exception {
+    public CPUTF8[][] parseCPUTF8References(String name, InputStream in,
+            BHSDCodec codec, int[] counts) throws IOException, Pack200Exception {
         String[] reference = segment.getCpBands().getCpUTF8();
         CPUTF8[][] result = new CPUTF8[counts.length][];
         int sum = 0;
@@ -496,8 +513,10 @@
             int index = indices[i1];
             if (index < 0 || index >= reference.length)
                 throw new Pack200Exception(
-                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
-            result1[i1] = segment.getCpBands().cpUTF8Value(reference[index], ClassConstantPool.DOMAIN_NORMALASCIIZ);
+                        "Something has gone wrong during parsing references, index = "
+                                + index + ", array size = " + reference.length);
+            result1[i1] = segment.getCpBands().cpUTF8Value(reference[index],
+                    ClassConstantPool.DOMAIN_NORMALASCIIZ);
         }
         CPUTF8[] refs = result1;
         int pos = 0;
@@ -510,7 +529,8 @@
         return result;
     }
 
-    public CPString[] parseCPStringReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
+    public CPString[] parseCPStringReferences(String name, InputStream in,
+            BHSDCodec codec, int count) throws IOException, Pack200Exception {
         String[] reference = segment.getCpBands().getCpString();
         int[] indices = decodeBandInt(name, in, codec, count);
         CPString[] result = new CPString[indices.length];
@@ -518,13 +538,16 @@
             int index = indices[i1];
             if (index < 0 || index >= reference.length)
                 throw new Pack200Exception(
-                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
+                        "Something has gone wrong during parsing references, index = "
+                                + index + ", array size = " + reference.length);
             result[i1] = segment.getCpBands().cpStringValue(reference[index]);
         }
         return result;
     }
 
-    public CPInterfaceMethodRef[] parseCPInterfaceMethodRefReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
+    public CPInterfaceMethodRef[] parseCPInterfaceMethodRefReferences(
+            String name, InputStream in, BHSDCodec codec, int count)
+            throws IOException, Pack200Exception {
         CpBands cpBands = segment.getCpBands();
         String[] reference = cpBands.getCpIMethodClass();
         String[] descriptors = cpBands.getCpIMethodDescriptor();
@@ -543,7 +566,9 @@
         return result;
     }
 
-    public CPMethodRef[] parseCPMethodRefReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
+    public CPMethodRef[] parseCPMethodRefReferences(String name,
+            InputStream in, BHSDCodec codec, int count) throws IOException,
+            Pack200Exception {
         CpBands cpBands = segment.getCpBands();
         String[] reference = cpBands.getCpMethodClass();
         String[] descriptors = cpBands.getCpMethodDescriptor();
@@ -555,13 +580,15 @@
                 throw new Pack200Exception(
                         "Something has gone wrong during parsing references, index = "
                                 + index + ", array size = " + reference.length);
-            result[i1] = new CPMethodRef(cpBands.cpClassValue(reference[index]),
-                    cpBands.cpNameAndTypeValue(descriptors[index]));
+            result[i1] = new CPMethodRef(
+                    cpBands.cpClassValue(reference[index]), cpBands
+                            .cpNameAndTypeValue(descriptors[index]));
         }
         return result;
     }
 
-    public CPFieldRef[] parseCPFieldRefReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
+    public CPFieldRef[] parseCPFieldRefReferences(String name, InputStream in,
+            BHSDCodec codec, int count) throws IOException, Pack200Exception {
         CpBands cpBands = segment.getCpBands();
         String[] reference = cpBands.getCpFieldClass();
         String[] descriptors = cpBands.getCpFieldDescriptor();
@@ -579,7 +606,9 @@
         return result;
     }
 
-    public CPNameAndType[] parseCPDescriptorReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
+    public CPNameAndType[] parseCPDescriptorReferences(String name,
+            InputStream in, BHSDCodec codec, int count) throws IOException,
+            Pack200Exception {
         CpBands cpBands = segment.getCpBands();
         String[] reference = cpBands.getCpDescriptor();
         int[] indices = decodeBandInt(name, in, codec, count);
@@ -588,13 +617,15 @@
             int index = indices[i1];
             if (index < 0 || index >= reference.length)
                 throw new Pack200Exception(
-                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
+                        "Something has gone wrong during parsing references, index = "
+                                + index + ", array size = " + reference.length);
             result[i1] = cpBands.cpNameAndTypeValue(reference[index]);
         }
         return result;
     }
 
-    public CPUTF8[] parseCPSignatureReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
+    public CPUTF8[] parseCPSignatureReferences(String name, InputStream in,
+            BHSDCodec codec, int count) throws IOException, Pack200Exception {
         String[] reference = segment.getCpBands().getCpSignature();
         int[] indices = decodeBandInt(name, in, codec, count);
         CPUTF8[] result = new CPUTF8[indices.length];
@@ -602,13 +633,16 @@
             int index = indices[i1];
             if (index < 0 || index >= reference.length)
                 throw new Pack200Exception(
-                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
-            result[i1] = segment.getCpBands().cpUTF8Value(reference[index], ClassConstantPool.DOMAIN_SIGNATUREASCIIZ);
+                        "Something has gone wrong during parsing references, index = "
+                                + index + ", array size = " + reference.length);
+            result[i1] = segment.getCpBands().cpUTF8Value(reference[index],
+                    ClassConstantPool.DOMAIN_SIGNATUREASCIIZ);
         }
         return result;
     }
 
-    public CPClass[] parseCPClassReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
+    public CPClass[] parseCPClassReferences(String name, InputStream in,
+            BHSDCodec codec, int count) throws IOException, Pack200Exception {
         String[] reference = segment.getCpBands().getCpClass();
         int[] indices = decodeBandInt(name, in, codec, count);
         CPClass[] result = new CPClass[indices.length];
@@ -616,7 +650,8 @@
             int index = indices[i1];
             if (index < 0 || index >= reference.length)
                 throw new Pack200Exception(
-                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
+                        "Something has gone wrong during parsing references, index = "
+                                + index + ", array size = " + reference.length);
             result[i1] = segment.getCpBands().cpClassValue(reference[index]);
         }
         return result;



Mime
View raw message