commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1417043 [5/21] - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/ main/java/org/apache/commons/imaging/color/ main/java/org/apache/commons/imaging/common/ main/java/org/apache/commons/imaging/common/bytesource/ m...
Date Tue, 04 Dec 2012 17:24:32 GMT
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java Tue Dec  4 17:23:16 2012
@@ -36,19 +36,19 @@ public class T4AndT6Compression {
 
     static {
         try {
-            for (Entry entry : T4_T6_Tables.whiteTerminatingCodes) {
+            for (final Entry entry : T4_T6_Tables.whiteTerminatingCodes) {
                 whiteRunLengths.insert(entry.bitString, entry.value);
             }
-            for (Entry entry : T4_T6_Tables.whiteMakeUpCodes) {
+            for (final Entry entry : T4_T6_Tables.whiteMakeUpCodes) {
                 whiteRunLengths.insert(entry.bitString, entry.value);
             }
-            for (Entry entry : T4_T6_Tables.blackTerminatingCodes) {
+            for (final Entry entry : T4_T6_Tables.blackTerminatingCodes) {
                 blackRunLengths.insert(entry.bitString, entry.value);
             }
-            for (Entry entry : T4_T6_Tables.blackMakeUpCodes) {
+            for (final Entry entry : T4_T6_Tables.blackMakeUpCodes) {
                 blackRunLengths.insert(entry.bitString, entry.value);
             }
-            for (Entry entry : T4_T6_Tables.additionalMakeUpCodes) {
+            for (final Entry entry : T4_T6_Tables.additionalMakeUpCodes) {
                 whiteRunLengths.insert(entry.bitString, entry.value);
                 blackRunLengths.insert(entry.bitString, entry.value);
             }
@@ -76,19 +76,19 @@ public class T4AndT6Compression {
             controlCodes.insert(T4_T6_Tables.VR1.bitString, T4_T6_Tables.VR1);
             controlCodes.insert(T4_T6_Tables.VR2.bitString, T4_T6_Tables.VR2);
             controlCodes.insert(T4_T6_Tables.VR3.bitString, T4_T6_Tables.VR3);
-        } catch (HuffmanTreeException cannotHappen) {
+        } catch (final HuffmanTreeException cannotHappen) {
             Debug.debug(cannotHappen);
         }
     }
 
-    private static void compress1DLine(BitInputStreamFlexible inputStream,
-            BitArrayOutputStream outputStream, int[] referenceLine, int width)
+    private static void compress1DLine(final BitInputStreamFlexible inputStream,
+            final BitArrayOutputStream outputStream, final int[] referenceLine, final int width)
             throws ImageWriteException {
         int color = WHITE;
         int runLength = 0;
         for (int x = 0; x < width; x++) {
             try {
-                int nextColor = inputStream.readBits(1);
+                final int nextColor = inputStream.readBits(1);
                 if (referenceLine != null) {
                     referenceLine[x] = nextColor;
                 }
@@ -99,7 +99,7 @@ public class T4AndT6Compression {
                     color = nextColor;
                     runLength = 1;
                 }
-            } catch (IOException ioException) {
+            } catch (final IOException ioException) {
                 throw new ImageWriteException(
                         "Error reading image to compress", ioException);
             }
@@ -118,11 +118,11 @@ public class T4AndT6Compression {
      * @return the compressed data
      * @throws ImageWriteException
      */
-    public static byte[] compressModifiedHuffman(byte[] uncompressed,
-            int width, int height) throws ImageWriteException {
-        BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
+    public static byte[] compressModifiedHuffman(final byte[] uncompressed,
+            final int width, final int height) throws ImageWriteException {
+        final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
                 new ByteArrayInputStream(uncompressed));
-        BitArrayOutputStream outputStream = new BitArrayOutputStream();
+        final BitArrayOutputStream outputStream = new BitArrayOutputStream();
         for (int y = 0; y < height; y++) {
             compress1DLine(inputStream, outputStream, null, width);
             inputStream.flushCache();
@@ -142,16 +142,16 @@ public class T4AndT6Compression {
      * @return the decompressed data
      * @throws ImageReadException
      */
-    public static byte[] decompressModifiedHuffman(byte[] compressed,
-            int width, int height) throws ImageReadException {
-        BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
+    public static byte[] decompressModifiedHuffman(final byte[] compressed,
+            final int width, final int height) throws ImageReadException {
+        final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
                 new ByteArrayInputStream(compressed));
-        BitArrayOutputStream outputStream = new BitArrayOutputStream();
+        final BitArrayOutputStream outputStream = new BitArrayOutputStream();
         for (int y = 0; y < height; y++) {
             int color = WHITE;
             int rowLength;
             for (rowLength = 0; rowLength < width;) {
-                int runLength = readTotalRunLength(inputStream, color);
+                final int runLength = readTotalRunLength(inputStream, color);
                 for (int i = 0; i < runLength; i++) {
                     outputStream.writeBit(color);
                 }
@@ -170,11 +170,11 @@ public class T4AndT6Compression {
         return outputStream.toByteArray();
     }
 
-    public static byte[] compressT4_1D(byte[] uncompressed, int width,
-            int height, boolean hasFill) throws ImageWriteException {
-        BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
+    public static byte[] compressT4_1D(final byte[] uncompressed, final int width,
+            final int height, final boolean hasFill) throws ImageWriteException {
+        final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
                 new ByteArrayInputStream(uncompressed));
-        BitArrayOutputStream outputStream = new BitArrayOutputStream();
+        final BitArrayOutputStream outputStream = new BitArrayOutputStream();
         if (hasFill) {
             T4_T6_Tables.EOL16.writeBits(outputStream);
         } else {
@@ -209,11 +209,11 @@ public class T4AndT6Compression {
      * @return the decompressed data
      * @throws ImageReadException
      */
-    public static byte[] decompressT4_1D(byte[] compressed, int width,
-            int height, boolean hasFill) throws ImageReadException {
-        BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
+    public static byte[] decompressT4_1D(final byte[] compressed, final int width,
+            final int height, final boolean hasFill) throws ImageReadException {
+        final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
                 new ByteArrayInputStream(compressed));
-        BitArrayOutputStream outputStream = new BitArrayOutputStream();
+        final BitArrayOutputStream outputStream = new BitArrayOutputStream();
         for (int y = 0; y < height; y++) {
             T4_T6_Tables.Entry entry;
             int rowLength;
@@ -224,14 +224,14 @@ public class T4AndT6Compression {
                 }
                 int color = WHITE;
                 for (rowLength = 0; rowLength < width;) {
-                    int runLength = readTotalRunLength(inputStream, color);
+                    final int runLength = readTotalRunLength(inputStream, color);
                     for (int i = 0; i < runLength; i++) {
                         outputStream.writeBit(color);
                     }
                     color = 1 - color;
                     rowLength += runLength;
                 }
-            } catch (HuffmanTreeException huffmanException) {
+            } catch (final HuffmanTreeException huffmanException) {
                 throw new ImageReadException("Decompression error",
                         huffmanException);
             }
@@ -246,12 +246,12 @@ public class T4AndT6Compression {
         return outputStream.toByteArray();
     }
 
-    public static byte[] compressT4_2D(byte[] uncompressed, int width,
-            int height, boolean hasFill, int parameterK)
+    public static byte[] compressT4_2D(final byte[] uncompressed, final int width,
+            final int height, final boolean hasFill, final int parameterK)
             throws ImageWriteException {
-        BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
+        final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
                 new ByteArrayInputStream(uncompressed));
-        BitArrayOutputStream outputStream = new BitArrayOutputStream();
+        final BitArrayOutputStream outputStream = new BitArrayOutputStream();
         int[] referenceLine = new int[width];
         int[] codingLine = new int[width];
         int kCounter = 0;
@@ -267,7 +267,7 @@ public class T4AndT6Compression {
                 for (int i = 0; i < width; i++) {
                     try {
                         codingLine[i] = inputStream.readBits(1);
-                    } catch (IOException ioException) {
+                    } catch (final IOException ioException) {
                         throw new ImageWriteException(
                                 "Error reading image to compress", ioException);
                     }
@@ -283,7 +283,7 @@ public class T4AndT6Compression {
                         T4_T6_Tables.P.writeBits(outputStream);
                         a0 = b2;
                     } else {
-                        int a1b1 = a1 - b1;
+                        final int a1b1 = a1 - b1;
                         if (-3 <= a1b1 && a1b1 <= 3) {
                             T4_T6_Tables.Entry entry;
                             if (a1b1 == -3) {
@@ -305,10 +305,10 @@ public class T4AndT6Compression {
                             codingA0Color = 1 - codingA0Color;
                             a0 = a1;
                         } else {
-                            int a2 = nextChangingElement(codingLine,
+                            final int a2 = nextChangingElement(codingLine,
                                     1 - codingA0Color, a1 + 1);
-                            int a0a1 = a1 - a0;
-                            int a1a2 = a2 - a1;
+                            final int a0a1 = a1 - a0;
+                            final int a1a2 = a2 - a1;
                             T4_T6_Tables.H.writeBits(outputStream);
                             writeRunLength(outputStream, a0a1, codingA0Color);
                             writeRunLength(outputStream, a1a2,
@@ -330,7 +330,7 @@ public class T4AndT6Compression {
                     b2 = nextChangingElement(referenceLine, 1 - codingA0Color,
                             b1 + 1);
                 }
-                int[] swap = referenceLine;
+                final int[] swap = referenceLine;
                 referenceLine = codingLine;
                 codingLine = swap;
             } else {
@@ -371,12 +371,12 @@ public class T4AndT6Compression {
      * @return the decompressed data
      * @throws ImageReadException
      */
-    public static byte[] decompressT4_2D(byte[] compressed, int width,
-            int height, boolean hasFill) throws ImageReadException {
-        BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
+    public static byte[] decompressT4_2D(final byte[] compressed, final int width,
+            final int height, final boolean hasFill) throws ImageReadException {
+        final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
                 new ByteArrayInputStream(compressed));
-        BitArrayOutputStream outputStream = new BitArrayOutputStream();
-        int[] referenceLine = new int[width];
+        final BitArrayOutputStream outputStream = new BitArrayOutputStream();
+        final int[] referenceLine = new int[width];
         for (int y = 0; y < height; y++) {
             T4_T6_Tables.Entry entry;
             int rowLength = 0;
@@ -385,7 +385,7 @@ public class T4AndT6Compression {
                 if (!isEOL(entry, hasFill)) {
                     throw new ImageReadException("Expected EOL not found");
                 }
-                int tagBit = inputStream.readBits(1);
+                final int tagBit = inputStream.readBits(1);
                 if (tagBit == 0) {
                     // 2D
                     int codingA0Color = WHITE;
@@ -403,12 +403,12 @@ public class T4AndT6Compression {
                                     codingA0Color);
                             a0 = b2;
                         } else if (entry == T4_T6_Tables.H) {
-                            int a0a1 = readTotalRunLength(inputStream,
+                            final int a0a1 = readTotalRunLength(inputStream,
                                     codingA0Color);
                             a1 = a0 + a0a1;
                             fillRange(outputStream, referenceLine, a0, a1,
                                     codingA0Color);
-                            int a1a2 = readTotalRunLength(inputStream,
+                            final int a1a2 = readTotalRunLength(inputStream,
                                     1 - codingA0Color);
                             a2 = a1 + a1a2;
                             fillRange(outputStream, referenceLine, a1, a2,
@@ -459,7 +459,7 @@ public class T4AndT6Compression {
                     // 1D
                     int color = WHITE;
                     for (rowLength = 0; rowLength < width;) {
-                        int runLength = readTotalRunLength(inputStream, color);
+                        final int runLength = readTotalRunLength(inputStream, color);
                         for (int i = 0; i < runLength; i++) {
                             outputStream.writeBit(color);
                             referenceLine[rowLength + i] = color;
@@ -468,9 +468,9 @@ public class T4AndT6Compression {
                         rowLength += runLength;
                     }
                 }
-            } catch (IOException ioException) {
+            } catch (final IOException ioException) {
                 throw new ImageReadException("Decompression error", ioException);
-            } catch (HuffmanTreeException huffmanException) {
+            } catch (final HuffmanTreeException huffmanException) {
                 throw new ImageReadException("Decompression error",
                         huffmanException);
             }
@@ -485,18 +485,18 @@ public class T4AndT6Compression {
         return outputStream.toByteArray();
     }
 
-    public static byte[] compressT6(byte[] uncompressed, int width, int height)
+    public static byte[] compressT6(final byte[] uncompressed, final int width, final int height)
             throws ImageWriteException {
-        BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
+        final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
                 new ByteArrayInputStream(uncompressed));
-        BitArrayOutputStream outputStream = new BitArrayOutputStream();
+        final BitArrayOutputStream outputStream = new BitArrayOutputStream();
         int[] referenceLine = new int[width];
         int[] codingLine = new int[width];
         for (int y = 0; y < height; y++) {
             for (int i = 0; i < width; i++) {
                 try {
                     codingLine[i] = inputStream.readBits(1);
-                } catch (IOException ioException) {
+                } catch (final IOException ioException) {
                     throw new ImageWriteException(
                             "Error reading image to compress", ioException);
                 }
@@ -512,7 +512,7 @@ public class T4AndT6Compression {
                     T4_T6_Tables.P.writeBits(outputStream);
                     a0 = b2;
                 } else {
-                    int a1b1 = a1 - b1;
+                    final int a1b1 = a1 - b1;
                     if (-3 <= a1b1 && a1b1 <= 3) {
                         T4_T6_Tables.Entry entry;
                         if (a1b1 == -3) {
@@ -534,10 +534,10 @@ public class T4AndT6Compression {
                         codingA0Color = 1 - codingA0Color;
                         a0 = a1;
                     } else {
-                        int a2 = nextChangingElement(codingLine,
+                        final int a2 = nextChangingElement(codingLine,
                                 1 - codingA0Color, a1 + 1);
-                        int a0a1 = a1 - a0;
-                        int a1a2 = a2 - a1;
+                        final int a0a1 = a1 - a0;
+                        final int a1a2 = a2 - a1;
                         T4_T6_Tables.H.writeBits(outputStream);
                         writeRunLength(outputStream, a0a1, codingA0Color);
                         writeRunLength(outputStream, a1a2, 1 - codingA0Color);
@@ -558,7 +558,7 @@ public class T4AndT6Compression {
                 b2 = nextChangingElement(referenceLine, 1 - codingA0Color,
                         b1 + 1);
             }
-            int[] swap = referenceLine;
+            final int[] swap = referenceLine;
             referenceLine = codingLine;
             codingLine = swap;
             inputStream.flushCache();
@@ -580,12 +580,12 @@ public class T4AndT6Compression {
      * @return the decompressed data
      * @throws ImageReadException
      */
-    public static byte[] decompressT6(byte[] compressed, int width, int height)
+    public static byte[] decompressT6(final byte[] compressed, final int width, final int height)
             throws ImageReadException {
-        BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
+        final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
                 new ByteArrayInputStream(compressed));
-        BitArrayOutputStream outputStream = new BitArrayOutputStream();
-        int[] referenceLine = new int[width];
+        final BitArrayOutputStream outputStream = new BitArrayOutputStream();
+        final int[] referenceLine = new int[width];
         for (int y = 0; y < height; y++) {
             T4_T6_Tables.Entry entry;
             int rowLength = 0;
@@ -604,12 +604,12 @@ public class T4AndT6Compression {
                                 codingA0Color);
                         a0 = b2;
                     } else if (entry == T4_T6_Tables.H) {
-                        int a0a1 = readTotalRunLength(inputStream,
+                        final int a0a1 = readTotalRunLength(inputStream,
                                 codingA0Color);
                         a1 = a0 + a0a1;
                         fillRange(outputStream, referenceLine, a0, a1,
                                 codingA0Color);
-                        int a1a2 = readTotalRunLength(inputStream,
+                        final int a1a2 = readTotalRunLength(inputStream,
                                 1 - codingA0Color);
                         a2 = a1 + a1a2;
                         fillRange(outputStream, referenceLine, a1, a2,
@@ -656,7 +656,7 @@ public class T4AndT6Compression {
                             b1 + 1);
                     rowLength = a0;
                 }
-            } catch (HuffmanTreeException huffmanException) {
+            } catch (final HuffmanTreeException huffmanException) {
                 throw new ImageReadException("Decompression error",
                         huffmanException);
             }
@@ -671,7 +671,7 @@ public class T4AndT6Compression {
         return outputStream.toByteArray();
     }
 
-    private static boolean isEOL(T4_T6_Tables.Entry entry, boolean hasFill) {
+    private static boolean isEOL(final T4_T6_Tables.Entry entry, final boolean hasFill) {
         if (entry == T4_T6_Tables.EOL) {
             return true;
         }
@@ -687,8 +687,8 @@ public class T4AndT6Compression {
         }
     }
 
-    private static void writeRunLength(BitArrayOutputStream bitStream,
-            int runLength, int color) {
+    private static void writeRunLength(final BitArrayOutputStream bitStream,
+            int runLength, final int color) {
         final T4_T6_Tables.Entry[] makeUpCodes;
         final T4_T6_Tables.Entry[] terminatingCodes;
         if (color == WHITE) {
@@ -699,26 +699,26 @@ public class T4AndT6Compression {
             terminatingCodes = T4_T6_Tables.blackTerminatingCodes;
         }
         while (runLength >= 1792) {
-            T4_T6_Tables.Entry entry = lowerBound(
+            final T4_T6_Tables.Entry entry = lowerBound(
                     T4_T6_Tables.additionalMakeUpCodes, runLength);
             entry.writeBits(bitStream);
             runLength -= entry.value.intValue();
         }
         while (runLength >= 64) {
-            T4_T6_Tables.Entry entry = lowerBound(makeUpCodes, runLength);
+            final T4_T6_Tables.Entry entry = lowerBound(makeUpCodes, runLength);
             entry.writeBits(bitStream);
             runLength -= entry.value.intValue();
         }
-        T4_T6_Tables.Entry terminatingEntry = terminatingCodes[runLength];
+        final T4_T6_Tables.Entry terminatingEntry = terminatingCodes[runLength];
         terminatingEntry.writeBits(bitStream);
     }
 
-    private static T4_T6_Tables.Entry lowerBound(T4_T6_Tables.Entry[] entries,
-            int value) {
+    private static T4_T6_Tables.Entry lowerBound(final T4_T6_Tables.Entry[] entries,
+            final int value) {
         int first = 0;
         int last = entries.length - 1;
         do {
-            int middle = (first + last) >>> 1;
+            final int middle = (first + last) >>> 1;
             if (entries[middle].value.intValue() <= value
                     && ((middle + 1) >= entries.length || value < entries[middle + 1].value
                             .intValue())) {
@@ -732,8 +732,8 @@ public class T4AndT6Compression {
         return entries[first];
     }
 
-    private static int readTotalRunLength(BitInputStreamFlexible bitStream,
-            int color) throws ImageReadException {
+    private static int readTotalRunLength(final BitInputStreamFlexible bitStream,
+            final int color) throws ImageReadException {
         try {
             int totalLength = 0;
             Integer runLength;
@@ -746,21 +746,21 @@ public class T4AndT6Compression {
                 totalLength += runLength.intValue();
             } while (runLength.intValue() > 63);
             return totalLength;
-        } catch (HuffmanTreeException huffmanException) {
+        } catch (final HuffmanTreeException huffmanException) {
             throw new ImageReadException("Decompression error",
                     huffmanException);
         }
     }
 
-    private static int changingElementAt(int[] line, int position) {
+    private static int changingElementAt(final int[] line, final int position) {
         if (position < 0 || position >= line.length) {
             return WHITE;
         }
         return line[position];
     }
 
-    private static int nextChangingElement(int[] line, int currentColour,
-            int start) {
+    private static int nextChangingElement(final int[] line, final int currentColour,
+            final int start) {
         int position;
         for (position = start; position < line.length
                 && line[position] == currentColour; position++) {
@@ -769,8 +769,8 @@ public class T4AndT6Compression {
         return position < line.length ? position : line.length;
     }
 
-    private static void fillRange(BitArrayOutputStream outputStream,
-            int[] referenceRow, int a0, int end, int color) {
+    private static void fillRange(final BitArrayOutputStream outputStream,
+            final int[] referenceRow, final int a0, final int end, final int color) {
         for (int i = a0; i < end; i++) {
             referenceRow[i] = color;
             outputStream.writeBit(color);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4_T6_Tables.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4_T6_Tables.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4_T6_Tables.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4_T6_Tables.java Tue Dec  4 17:23:16 2012
@@ -23,12 +23,12 @@ class T4_T6_Tables {
         String bitString;
         Integer value;
 
-        public Entry(String bitString, Integer value) {
+        public Entry(final String bitString, final Integer value) {
             this.bitString = bitString;
             this.value = value;
         }
 
-        public void writeBits(BitArrayOutputStream outputStream) {
+        public void writeBits(final BitArrayOutputStream outputStream) {
             for (int i = 0; i < bitString.length(); i++) {
                 if (bitString.charAt(i) == '0') {
                     outputStream.writeBit(0);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/BitsToByteInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/BitsToByteInputStream.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/BitsToByteInputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/BitsToByteInputStream.java Tue Dec  4 17:23:16 2012
@@ -23,7 +23,7 @@ public class BitsToByteInputStream exten
     private final MyBitInputStream is;
     private final int desiredDepth;
 
-    public BitsToByteInputStream(MyBitInputStream is, int desiredDepth) {
+    public BitsToByteInputStream(final MyBitInputStream is, final int desiredDepth) {
         this.is = is;
         this.desiredDepth = desiredDepth;
     }
@@ -33,7 +33,7 @@ public class BitsToByteInputStream exten
         return readBits(8);
     }
 
-    public int readBits(int bitCount) throws IOException {
+    public int readBits(final int bitCount) throws IOException {
         int i = is.readBits(bitCount);
         if (bitCount < desiredDepth) {
             i <<= (desiredDepth - bitCount);
@@ -44,8 +44,8 @@ public class BitsToByteInputStream exten
         return i;
     }
 
-    public int[] readBitsArray(int sampleBits, int length) throws IOException {
-        int result[] = new int[length];
+    public int[] readBitsArray(final int sampleBits, final int length) throws IOException {
+        final int result[] = new int[length];
 
         for (int i = 0; i < length; i++) {
             result[i] = readBits(sampleBits);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitInputStream.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitInputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitInputStream.java Tue Dec  4 17:23:16 2012
@@ -26,7 +26,7 @@ public class MyBitInputStream extends In
     private final ByteOrder byteOrder;
     private boolean tiffLZWMode = false;
 
-    public MyBitInputStream(InputStream is, ByteOrder byteOrder) {
+    public MyBitInputStream(final InputStream is, final ByteOrder byteOrder) {
         this.byteOrder = byteOrder;
         this.is = is;
     }
@@ -44,9 +44,9 @@ public class MyBitInputStream extends In
         tiffLZWMode = true;
     }
 
-    public int readBits(int SampleBits) throws IOException {
+    public int readBits(final int SampleBits) throws IOException {
         while (bitsInCache < SampleBits) {
-            int next = is.read();
+            final int next = is.read();
 
             if (next < 0) {
                 if (tiffLZWMode) {
@@ -56,7 +56,7 @@ public class MyBitInputStream extends In
                 return -1;
             }
 
-            int newByte = (0xff & next);
+            final int newByte = (0xff & next);
 
             if (byteOrder == ByteOrder.NETWORK) {
                 bitCache = (bitCache << 8) | newByte;
@@ -67,7 +67,7 @@ public class MyBitInputStream extends In
             bytesRead++;
             bitsInCache += 8;
         }
-        int sampleMask = (1 << SampleBits) - 1;
+        final int sampleMask = (1 << SampleBits) - 1;
 
         int sample;
 
@@ -78,10 +78,10 @@ public class MyBitInputStream extends In
             bitCache >>= SampleBits;
         }
 
-        int result = sample;
+        final int result = sample;
 
         bitsInCache -= SampleBits;
-        int remainderMask = (1 << bitsInCache) - 1;
+        final int remainderMask = (1 << bitsInCache) - 1;
         bitCache &= remainderMask;
 
         return result;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitOutputStream.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitOutputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitOutputStream.java Tue Dec  4 17:23:16 2012
@@ -25,13 +25,13 @@ public class MyBitOutputStream extends O
     private final OutputStream os;
     private final ByteOrder byteOrder;
 
-    public MyBitOutputStream(OutputStream os, ByteOrder byteOrder) {
+    public MyBitOutputStream(final OutputStream os, final ByteOrder byteOrder) {
         this.byteOrder = byteOrder;
         this.os = os;
     }
 
     @Override
-    public void write(int value) throws IOException {
+    public void write(final int value) throws IOException {
         writeBits(value, 8);
     }
 
@@ -40,8 +40,8 @@ public class MyBitOutputStream extends O
 
     // TODO: in and out streams CANNOT accurately read/write 32bits at a time,
     // as int will overflow. should have used a long
-    public void writeBits(int value, int SampleBits) throws IOException {
-        int sampleMask = (1 << SampleBits) - 1;
+    public void writeBits(int value, final int SampleBits) throws IOException {
+        final int sampleMask = (1 << SampleBits) - 1;
         value &= sampleMask;
 
         if (byteOrder == ByteOrder.NETWORK) {
@@ -56,19 +56,19 @@ public class MyBitOutputStream extends O
         while (bitsInCache >= 8) {
             if (byteOrder == ByteOrder.NETWORK) {
                 // MSB, so write from left
-                int b = 0xff & (bitCache >> (bitsInCache - 8));
+                final int b = 0xff & (bitCache >> (bitsInCache - 8));
                 actualWrite(b);
 
                 bitsInCache -= 8;
             } else {
                 // LSB, so write from right
-                int b = 0xff & bitCache;
+                final int b = 0xff & bitCache;
                 actualWrite(b);
 
                 bitCache >>= 8;
                 bitsInCache -= 8;
             }
-            int remainderMask = (1 << bitsInCache) - 1; // unneccesary
+            final int remainderMask = (1 << bitsInCache) - 1; // unneccesary
             bitCache &= remainderMask; // unneccesary
         }
 
@@ -76,14 +76,14 @@ public class MyBitOutputStream extends O
 
     private int bytesWritten = 0;
 
-    private void actualWrite(int value) throws IOException {
+    private void actualWrite(final int value) throws IOException {
         os.write(value);
         bytesWritten++;
     }
 
     public void flushCache() throws IOException {
         if (bitsInCache > 0) {
-            int bitMask = (1 << bitsInCache) - 1;
+            final int bitMask = (1 << bitsInCache) - 1;
             int b = bitMask & bitCache;
 
             if (byteOrder == ByteOrder.NETWORK) { 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwCompressor.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwCompressor.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwCompressor.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwCompressor.java Tue Dec  4 17:23:16 2012
@@ -34,13 +34,13 @@ public class MyLzwCompressor {
     private final int eoiCode;
     private final Listener listener;
 
-    public MyLzwCompressor(int initialCodeSize, ByteOrder byteOrder,
-            boolean earlyLimit) {
+    public MyLzwCompressor(final int initialCodeSize, final ByteOrder byteOrder,
+            final boolean earlyLimit) {
         this(initialCodeSize, byteOrder, earlyLimit, null);
     }
 
-    public MyLzwCompressor(int initialCodeSize, ByteOrder byteOrder,
-            boolean earlyLimit, Listener listener) {
+    public MyLzwCompressor(final int initialCodeSize, final ByteOrder byteOrder,
+            final boolean earlyLimit, final Listener listener) {
         this.listener = listener;
         this.byteOrder = byteOrder;
         this.earlyLimit = earlyLimit;
@@ -62,12 +62,12 @@ public class MyLzwCompressor {
     private final void InitializeStringTable() {
         codeSize = initialCodeSize;
 
-        int intial_entries_count = (1 << codeSize) + 2;
+        final int intial_entries_count = (1 << codeSize) + 2;
 
         map.clear();
         for (codes = 0; codes < intial_entries_count; codes++) {
             if ((codes != clearCode) && (codes != eoiCode)) {
-                Object key = arrayToKey((byte) codes);
+                final Object key = arrayToKey((byte) codes);
 
                 map.put(key, codes);
             }
@@ -85,7 +85,7 @@ public class MyLzwCompressor {
         }
     }
 
-    private final Object arrayToKey(byte b) {
+    private final Object arrayToKey(final byte b) {
         return arrayToKey(new byte[] { b, }, 0, 1);
     }
 
@@ -95,7 +95,7 @@ public class MyLzwCompressor {
         private final int length;
         private final int hash;
 
-        public ByteArray(byte bytes[], int start, int length) {
+        public ByteArray(final byte bytes[], final int start, final int length) {
             this.bytes = bytes;
             this.start = start;
             this.length = length;
@@ -103,7 +103,7 @@ public class MyLzwCompressor {
             int tempHash = length;
 
             for (int i = 0; i < length; i++) {
-                int b = 0xff & bytes[i + start];
+                final int b = 0xff & bytes[i + start];
                 tempHash = tempHash + (tempHash << 8) ^ b ^ i;
             }
 
@@ -116,9 +116,9 @@ public class MyLzwCompressor {
         }
 
         @Override
-        public boolean equals(Object o) {
+        public boolean equals(final Object o) {
             if (o instanceof ByteArray) {
-                ByteArray other = (ByteArray) o;
+                final ByteArray other = (ByteArray) o;
                 if (other.hash != hash) {
                     return false;
                 }
@@ -138,11 +138,11 @@ public class MyLzwCompressor {
         }
     }
 
-    private final Object arrayToKey(byte bytes[], int start, int length) {
+    private final Object arrayToKey(final byte bytes[], final int start, final int length) {
         return new ByteArray(bytes, start, length);
     }
 
-    private final void writeDataCode(MyBitOutputStream bos, int code)
+    private final void writeDataCode(final MyBitOutputStream bos, final int code)
             throws IOException {
         if (null != listener) {
             listener.dataCode(code);
@@ -150,48 +150,48 @@ public class MyLzwCompressor {
         writeCode(bos, code);
     }
 
-    private final void writeClearCode(MyBitOutputStream bos) throws IOException {
+    private final void writeClearCode(final MyBitOutputStream bos) throws IOException {
         if (null != listener) {
             listener.dataCode(clearCode);
         }
         writeCode(bos, clearCode);
     }
 
-    private final void writeEoiCode(MyBitOutputStream bos) throws IOException {
+    private final void writeEoiCode(final MyBitOutputStream bos) throws IOException {
         if (null != listener) {
             listener.eoiCode(eoiCode);
         }
         writeCode(bos, eoiCode);
     }
 
-    private final void writeCode(MyBitOutputStream bos, int code)
+    private final void writeCode(final MyBitOutputStream bos, final int code)
             throws IOException {
         bos.writeBits(code, codeSize);
     }
 
-    private final boolean isInTable(byte bytes[], int start, int length) {
-        Object key = arrayToKey(bytes, start, length);
+    private final boolean isInTable(final byte bytes[], final int start, final int length) {
+        final Object key = arrayToKey(bytes, start, length);
 
         return map.containsKey(key);
     }
 
-    private final int codeFromString(byte bytes[], int start, int length)
+    private final int codeFromString(final byte bytes[], final int start, final int length)
             throws IOException {
-        Object key = arrayToKey(bytes, start, length);
-        Object o = map.get(key);
+        final Object key = arrayToKey(bytes, start, length);
+        final Object o = map.get(key);
         if (o == null) {
             throw new IOException("CodeFromString");
         }
         return ((Integer) o).intValue();
     }
 
-    private final boolean addTableEntry(MyBitOutputStream bos, byte bytes[],
-            int start, int length) throws IOException {
-        Object key = arrayToKey(bytes, start, length);
+    private final boolean addTableEntry(final MyBitOutputStream bos, final byte bytes[],
+            final int start, final int length) throws IOException {
+        final Object key = arrayToKey(bytes, start, length);
         return addTableEntry(bos, key);
     }
 
-    private final boolean addTableEntry(MyBitOutputStream bos, Object key)
+    private final boolean addTableEntry(final MyBitOutputStream bos, final Object key)
             throws IOException {
         boolean cleared = false;
 
@@ -228,9 +228,9 @@ public class MyLzwCompressor {
         public void init(int clearCode, int eoiCode);
     }
 
-    public byte[] compress(byte bytes[]) throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length);
-        MyBitOutputStream bos = new MyBitOutputStream(baos, byteOrder);
+    public byte[] compress(final byte bytes[]) throws IOException {
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length);
+        final MyBitOutputStream bos = new MyBitOutputStream(baos, byteOrder);
 
         InitializeStringTable();
         clearTable();
@@ -243,7 +243,7 @@ public class MyLzwCompressor {
             if (isInTable(bytes, w_start, w_length + 1)) {
                 w_length++;
             } else {
-                int code = codeFromString(bytes, w_start, w_length);
+                final int code = codeFromString(bytes, w_start, w_length);
                 writeDataCode(bos, code);
                 addTableEntry(bos, bytes, w_start, w_length + 1);
 
@@ -252,7 +252,7 @@ public class MyLzwCompressor {
             }
         }
 
-        int code = codeFromString(bytes, w_start, w_length);
+        final int code = codeFromString(bytes, w_start, w_length);
         writeDataCode(bos, code);
 
         writeEoiCode(bos);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java Tue Dec  4 17:23:16 2012
@@ -41,12 +41,12 @@ public final class MyLzwDecompressor {
         public void init(int clearCode, int eoiCode);
     }
 
-    public MyLzwDecompressor(int initialCodeSize, ByteOrder byteOrder) {
+    public MyLzwDecompressor(final int initialCodeSize, final ByteOrder byteOrder) {
         this(initialCodeSize, byteOrder, null);
     }
 
-    public MyLzwDecompressor(int initialCodeSize, ByteOrder byteOrder,
-            Listener listener) {
+    public MyLzwDecompressor(final int initialCodeSize, final ByteOrder byteOrder,
+            final Listener listener) {
         this.listener = listener;
         this.byteOrder = byteOrder;
 
@@ -66,7 +66,7 @@ public final class MyLzwDecompressor {
     private void InitializeTable() {
         codeSize = initialCodeSize;
 
-        int intial_entries_count = 1 << codeSize + 2;
+        final int intial_entries_count = 1 << codeSize + 2;
 
         for (int i = 0; i < intial_entries_count; i++) {
             table[i] = new byte[] { (byte) i, };
@@ -82,8 +82,8 @@ public final class MyLzwDecompressor {
     private final int clearCode;
     private final int eoiCode;
 
-    private int getNextCode(MyBitInputStream is) throws IOException {
-        int code = is.readBits(codeSize);
+    private int getNextCode(final MyBitInputStream is) throws IOException {
+        final int code = is.readBits(codeSize);
 
         if (null != listener) {
             listener.code(code);
@@ -91,7 +91,7 @@ public final class MyLzwDecompressor {
         return code;
     }
 
-    private byte[] stringFromCode(int code) throws IOException {
+    private byte[] stringFromCode(final int code) throws IOException {
         if ((code >= codes) || (code < 0)) {
             throw new IOException("Bad Code: " + code + " codes: " + codes
                     + " code_size: " + codeSize + ", table: " + table.length);
@@ -99,15 +99,15 @@ public final class MyLzwDecompressor {
         return table[code];
     }
 
-    private boolean isInTable(int Code) {
+    private boolean isInTable(final int Code) {
         return Code < codes;
     }
 
-    private byte firstChar(byte bytes[]) {
+    private byte firstChar(final byte bytes[]) {
         return bytes[0];
     }
 
-    private void addStringToTable(byte bytes[]) throws IOException {
+    private void addStringToTable(final byte bytes[]) throws IOException {
         if (codes < (1 << codeSize)) {
             table[codes] = bytes;
             codes++;
@@ -118,8 +118,8 @@ public final class MyLzwDecompressor {
         checkCodeSize();
     }
 
-    private byte[] appendBytes(byte bytes[], byte b) {
-        byte result[] = new byte[bytes.length + 1];
+    private byte[] appendBytes(final byte bytes[], final byte b) {
+        final byte result[] = new byte[bytes.length + 1];
 
         System.arraycopy(bytes, 0, result, 0, bytes.length);
         result[result.length - 1] = b;
@@ -128,7 +128,7 @@ public final class MyLzwDecompressor {
 
     private int written = 0;
 
-    private void writeToResult(OutputStream os, byte bytes[])
+    private void writeToResult(final OutputStream os, final byte bytes[])
             throws IOException {
         os.write(bytes);
         written += bytes.length;
@@ -140,15 +140,15 @@ public final class MyLzwDecompressor {
         tiffLZWMode = true;
     }
 
-    public byte[] decompress(InputStream is, int expectedLength)
+    public byte[] decompress(final InputStream is, final int expectedLength)
             throws IOException {
         int code, oldCode = -1;
-        MyBitInputStream mbis = new MyBitInputStream(is, byteOrder);
+        final MyBitInputStream mbis = new MyBitInputStream(is, byteOrder);
         if (tiffLZWMode) {
             mbis.setTiffLZWMode();
         }
 
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(expectedLength);
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream(expectedLength);
 
         clearTable();
 
@@ -176,7 +176,7 @@ public final class MyLzwDecompressor {
                             firstChar(stringFromCode(code))));
                     oldCode = code;
                 } else {
-                    byte OutString[] = appendBytes(stringFromCode(oldCode),
+                    final byte OutString[] = appendBytes(stringFromCode(oldCode),
                             firstChar(stringFromCode(oldCode)));
                     writeToResult(baos, OutString);
                     addStringToTable(OutString);
@@ -189,7 +189,7 @@ public final class MyLzwDecompressor {
             }
         } // end of while loop
 
-        byte result[] = baos.toByteArray();
+        final byte result[] = baos.toByteArray();
 
         return result;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpHeaderInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpHeaderInfo.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpHeaderInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpHeaderInfo.java Tue Dec  4 17:23:16 2012
@@ -67,14 +67,14 @@ public class BmpHeaderInfo {
         public ColorSpaceCoordinate blue;
     }
 
-    public BmpHeaderInfo(byte identifier1, byte identifier2, int fileSize,
-            int reserved, int bitmapDataOffset, int bitmapHeaderSize,
-            int width, int height, int planes, int bitsPerPixel,
-            int compression, int bitmapDataSize, int hResolution,
-            int vResolution, int colorsUsed, int colorsImportant, int redMask,
-            int greenMask, int blueMask, int alphaMask, int colorSpaceType,
-            ColorSpace colorSpace, int gammaRed, int gammaGreen, int gammaBlue,
-            int intent, int profileData, int profileSize, int reservedV5) {
+    public BmpHeaderInfo(final byte identifier1, final byte identifier2, final int fileSize,
+            final int reserved, final int bitmapDataOffset, final int bitmapHeaderSize,
+            final int width, final int height, final int planes, final int bitsPerPixel,
+            final int compression, final int bitmapDataSize, final int hResolution,
+            final int vResolution, final int colorsUsed, final int colorsImportant, final int redMask,
+            final int greenMask, final int blueMask, final int alphaMask, final int colorSpaceType,
+            final ColorSpace colorSpace, final int gammaRed, final int gammaGreen, final int gammaBlue,
+            final int intent, final int profileData, final int profileSize, final int reservedV5) {
         this.identifier1 = identifier1;
         this.identifier2 = identifier2;
         this.fileSize = fileSize;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java Tue Dec  4 17:23:16 2012
@@ -86,23 +86,23 @@ public class BmpImageParser extends Imag
 
     private static final byte BMP_HEADER_SIGNATURE[] = { 0x42, 0x4d, };
 
-    private BmpHeaderInfo readBmpHeaderInfo(InputStream is,
-            FormatCompliance formatCompliance, boolean verbose)
+    private BmpHeaderInfo readBmpHeaderInfo(final InputStream is,
+            final FormatCompliance formatCompliance, final boolean verbose)
             throws ImageReadException, IOException {
-        byte identifier1 = readByte("Identifier1", is, "Not a Valid BMP File");
-        byte identifier2 = readByte("Identifier2", is, "Not a Valid BMP File");
+        final byte identifier1 = readByte("Identifier1", is, "Not a Valid BMP File");
+        final byte identifier2 = readByte("Identifier2", is, "Not a Valid BMP File");
 
         if (formatCompliance != null) {
             formatCompliance.compare_bytes("Signature", BMP_HEADER_SIGNATURE,
                     new byte[] { identifier1, identifier2, });
         }
 
-        int fileSize = read4Bytes("File Size", is, "Not a Valid BMP File");
-        int reserved = read4Bytes("Reserved", is, "Not a Valid BMP File");
-        int bitmapDataOffset = read4Bytes("Bitmap Data Offset", is,
+        final int fileSize = read4Bytes("File Size", is, "Not a Valid BMP File");
+        final int reserved = read4Bytes("Reserved", is, "Not a Valid BMP File");
+        final int bitmapDataOffset = read4Bytes("Bitmap Data Offset", is,
                 "Not a Valid BMP File");
 
-        int bitmapHeaderSize = read4Bytes("Bitmap Header Size", is,
+        final int bitmapHeaderSize = read4Bytes("Bitmap Header Size", is,
                 "Not a Valid BMP File");
         int width = 0;
         int height = 0;
@@ -119,7 +119,7 @@ public class BmpImageParser extends Imag
         int blueMask = 0;
         int alphaMask = 0;
         int colorSpaceType = 0;
-        BmpHeaderInfo.ColorSpace colorSpace = new BmpHeaderInfo.ColorSpace();
+        final BmpHeaderInfo.ColorSpace colorSpace = new BmpHeaderInfo.ColorSpace();
         colorSpace.red = new BmpHeaderInfo.ColorSpaceCoordinate();
         colorSpace.green = new BmpHeaderInfo.ColorSpaceCoordinate();
         colorSpace.blue = new BmpHeaderInfo.ColorSpaceCoordinate();
@@ -247,7 +247,7 @@ public class BmpImageParser extends Imag
             }
         }
 
-        BmpHeaderInfo result = new BmpHeaderInfo(identifier1, identifier2,
+        final BmpHeaderInfo result = new BmpHeaderInfo(identifier1, identifier2,
                 fileSize, reserved, bitmapDataOffset, bitmapHeaderSize, width,
                 height, planes, bitsPerPixel, compression, bitmapDataSize,
                 hResolution, vResolution, colorsUsed, colorsImportant, redMask,
@@ -262,17 +262,17 @@ public class BmpImageParser extends Imag
     private static final int BI_RLE8 = 1;
     private static final int BI_BITFIELDS = 3;
 
-    private byte[] getRLEBytes(InputStream is, int RLESamplesPerByte)
+    private byte[] getRLEBytes(final InputStream is, final int RLESamplesPerByte)
             throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
         // this.setDebug(true);
 
         boolean done = false;
         while (!done) {
-            int a = 0xff & this.readByte("RLE a", is, "BMP: Bad RLE");
+            final int a = 0xff & this.readByte("RLE a", is, "BMP: Bad RLE");
             baos.write(a);
-            int b = 0xff & this.readByte("RLE b", is, "BMP: Bad RLE");
+            final int b = 0xff & this.readByte("RLE b", is, "BMP: Bad RLE");
             baos.write(b);
 
             if (a == 0) {
@@ -287,9 +287,9 @@ public class BmpImageParser extends Imag
                 case 2: {
                     // System.out.println("xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
                     // );
-                    int c = 0xff & this.readByte("RLE c", is, "BMP: Bad RLE");
+                    final int c = 0xff & this.readByte("RLE c", is, "BMP: Bad RLE");
                     baos.write(c);
-                    int d = 0xff & this.readByte("RLE d", is, "BMP: Bad RLE");
+                    final int d = 0xff & this.readByte("RLE d", is, "BMP: Bad RLE");
                     baos.write(d);
 
                 }
@@ -309,7 +309,7 @@ public class BmpImageParser extends Imag
                     // RLESamplesPerByte);
                     // System.out.println("xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
                     // );
-                    byte bytes[] = this.readByteArray("bytes", size, is,
+                    final byte bytes[] = this.readByteArray("bytes", size, is,
                             "RLE: Absolute Mode");
                     baos.write(bytes);
                 }
@@ -321,10 +321,10 @@ public class BmpImageParser extends Imag
         return baos.toByteArray();
     }
 
-    private ImageContents readImageContents(InputStream is,
-            FormatCompliance formatCompliance, boolean verbose)
+    private ImageContents readImageContents(final InputStream is,
+            final FormatCompliance formatCompliance, final boolean verbose)
             throws ImageReadException, IOException {
-        BmpHeaderInfo bhi = readBmpHeaderInfo(is, formatCompliance, verbose);
+        final BmpHeaderInfo bhi = readBmpHeaderInfo(is, formatCompliance, verbose);
 
         int colorTableSize = bhi.colorsUsed;
         if (colorTableSize == 0) {
@@ -416,7 +416,7 @@ public class BmpImageParser extends Imag
                     + ((colorTable == null) ? "null" : "" + colorTable.length));
         }
 
-        int pixelCount = bhi.width * bhi.height;
+        final int pixelCount = bhi.width * bhi.height;
 
         int imageLineLength = ((((bhi.bitsPerPixel) * bhi.width) + 7) / 8);
 
@@ -441,13 +441,13 @@ public class BmpImageParser extends Imag
                 + bhi.bitmapHeaderSize
                 + (bhi.bitmapHeaderSize == 40
                         && bhi.compression == BI_BITFIELDS ? 3 * 4 : 0);
-        int expectedDataOffset = headerSize + paletteLength;
+        final int expectedDataOffset = headerSize + paletteLength;
 
         if (verbose) {
             this.debugNumber("bhi.BitmapDataOffset", bhi.bitmapDataOffset, 4);
             this.debugNumber("expectedDataOffset", expectedDataOffset, 4);
         }
-        int extraBytes = bhi.bitmapDataOffset - expectedDataOffset;
+        final int extraBytes = bhi.bitmapDataOffset - expectedDataOffset;
         if (extraBytes < 0) {
             throw new ImageReadException("BMP has invalid image data offset: "
                     + bhi.bitmapDataOffset + " (expected: "
@@ -458,7 +458,7 @@ public class BmpImageParser extends Imag
                     "Not a Valid BMP File");
         }
 
-        int imageDataSize = bhi.height * imageLineLength;
+        final int imageDataSize = bhi.height * imageLineLength;
 
         if (verbose) {
             this.debugNumber("imageDataSize", imageDataSize, 4);
@@ -497,8 +497,8 @@ public class BmpImageParser extends Imag
         return new ImageContents(bhi, colorTable, imageData, pixelParser);
     }
 
-    private BmpHeaderInfo readBmpHeaderInfo(ByteSource byteSource,
-            boolean verbose) throws ImageReadException, IOException {
+    private BmpHeaderInfo readBmpHeaderInfo(final ByteSource byteSource,
+            final boolean verbose) throws ImageReadException, IOException {
         InputStream is = null;
         try {
             is = byteSource.getInputStream();
@@ -510,7 +510,7 @@ public class BmpImageParser extends Imag
                 if (is != null) {
                     is.close();
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 Debug.debug(e);
             }
 
@@ -518,18 +518,18 @@ public class BmpImageParser extends Imag
     }
 
     @Override
-    public byte[] getICCProfileBytes(ByteSource byteSource, Map<String,Object> params)
+    public byte[] getICCProfileBytes(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }
 
     @Override
-    public Dimension getImageSize(ByteSource byteSource, Map<String,Object> params)
+    public Dimension getImageSize(final ByteSource byteSource, Map<String,Object> params)
             throws ImageReadException, IOException {
         // make copy of params; we'll clear keys as we consume them.
         params = (params == null) ? new HashMap<String,Object>() : new HashMap<String,Object>(params);
 
-        boolean verbose = ParamMap.getParamBoolean(params, PARAM_KEY_VERBOSE,
+        final boolean verbose = ParamMap.getParamBoolean(params, PARAM_KEY_VERBOSE,
                 false);
 
         if (params.containsKey(PARAM_KEY_VERBOSE)) {
@@ -537,11 +537,11 @@ public class BmpImageParser extends Imag
         }
 
         if (params.size() > 0) {
-            Object firstKey = params.keySet().iterator().next();
+            final Object firstKey = params.keySet().iterator().next();
             throw new ImageReadException("Unknown parameter: " + firstKey);
         }
 
-        BmpHeaderInfo bhi = readBmpHeaderInfo(byteSource, verbose);
+        final BmpHeaderInfo bhi = readBmpHeaderInfo(byteSource, verbose);
 
         if (bhi == null) {
             throw new ImageReadException("BMP: couldn't read header");
@@ -551,22 +551,22 @@ public class BmpImageParser extends Imag
 
     }
 
-    public byte[] embedICCProfile(byte image[], byte profile[]) {
+    public byte[] embedICCProfile(final byte image[], final byte profile[]) {
         return null;
     }
 
     @Override
-    public boolean embedICCProfile(File src, File dst, byte profile[]) {
+    public boolean embedICCProfile(final File src, final File dst, final byte profile[]) {
         return false;
     }
 
     @Override
-    public IImageMetadata getMetadata(ByteSource byteSource, Map<String,Object> params)
+    public IImageMetadata getMetadata(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }
 
-    private String getBmpTypeDescription(int Identifier1, int Identifier2) {
+    private String getBmpTypeDescription(final int Identifier1, final int Identifier2) {
         if ((Identifier1 == 'B') && (Identifier2 == 'M')) {
             return "Windows 3.1x, 95, NT,";
         }
@@ -590,12 +590,12 @@ public class BmpImageParser extends Imag
     }
 
     @Override
-    public ImageInfo getImageInfo(ByteSource byteSource, Map<String,Object> params)
+    public ImageInfo getImageInfo(final ByteSource byteSource, Map<String,Object> params)
             throws ImageReadException, IOException {
         // make copy of params; we'll clear keys as we consume them.
         params = (params == null) ? new HashMap<String,Object>() : new HashMap<String,Object>(params);
 
-        boolean verbose = ParamMap.getParamBoolean(params, PARAM_KEY_VERBOSE,
+        final boolean verbose = ParamMap.getParamBoolean(params, PARAM_KEY_VERBOSE,
                 false);
 
         if (params.containsKey(PARAM_KEY_VERBOSE)) {
@@ -603,7 +603,7 @@ public class BmpImageParser extends Imag
         }
 
         if (params.size() > 0) {
-            Object firstKey = params.keySet().iterator().next();
+            final Object firstKey = params.keySet().iterator().next();
             throw new ImageReadException("Unknown parameter: " + firstKey);
         }
 
@@ -616,7 +616,7 @@ public class BmpImageParser extends Imag
             if (is != null) {
                 try {
                     is.close();
-                } catch (IOException ignore) {
+                } catch (final IOException ignore) {
                     Debug.debug(ignore);
                 }
             }
@@ -626,47 +626,47 @@ public class BmpImageParser extends Imag
             throw new ImageReadException("Couldn't read BMP Data");
         }
 
-        BmpHeaderInfo bhi = ic.bhi;
-        byte colorTable[] = ic.colorTable;
+        final BmpHeaderInfo bhi = ic.bhi;
+        final byte colorTable[] = ic.colorTable;
 
         if (bhi == null) {
             throw new ImageReadException("BMP: couldn't read header");
         }
 
-        int height = bhi.height;
-        int width = bhi.width;
+        final int height = bhi.height;
+        final int width = bhi.width;
 
-        List<String> comments = new ArrayList<String>();
+        final List<String> comments = new ArrayList<String>();
         // TODO: comments...
 
-        int bitsPerPixel = bhi.bitsPerPixel;
-        ImageFormat format = ImageFormat.IMAGE_FORMAT_BMP;
-        String name = "BMP Windows Bitmap";
-        String mimeType = "image/x-ms-bmp";
+        final int bitsPerPixel = bhi.bitsPerPixel;
+        final ImageFormat format = ImageFormat.IMAGE_FORMAT_BMP;
+        final String name = "BMP Windows Bitmap";
+        final String mimeType = "image/x-ms-bmp";
         // we ought to count images, but don't yet.
-        int numberOfImages = -1;
+        final int numberOfImages = -1;
         // not accurate ... only reflects first
-        boolean isProgressive = false;
+        final boolean isProgressive = false;
         // boolean isProgressive = (fPNGChunkIHDR.InterlaceMethod != 0);
         //
         // pixels per meter
-        int physicalWidthDpi = (int) (bhi.hResolution * .0254);
-        float physicalWidthInch = (float) ((double) width / (double) physicalWidthDpi);
+        final int physicalWidthDpi = (int) (bhi.hResolution * .0254);
+        final float physicalWidthInch = (float) ((double) width / (double) physicalWidthDpi);
         // int physicalHeightDpi = 72;
-        int physicalHeightDpi = (int) (bhi.vResolution * .0254);
-        float physicalHeightInch = (float) ((double) height / (double) physicalHeightDpi);
+        final int physicalHeightDpi = (int) (bhi.vResolution * .0254);
+        final float physicalHeightInch = (float) ((double) height / (double) physicalHeightDpi);
 
-        String formatDetails = "Bmp (" + (char) bhi.identifier1
+        final String formatDetails = "Bmp (" + (char) bhi.identifier1
                 + (char) bhi.identifier2 + ": "
                 + getBmpTypeDescription(bhi.identifier1, bhi.identifier2) + ")";
 
-        boolean isTransparent = false;
+        final boolean isTransparent = false;
 
-        boolean usesPalette = colorTable != null;
-        int colorType = ImageInfo.COLOR_TYPE_RGB;
-        String compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_RLE;
+        final boolean usesPalette = colorTable != null;
+        final int colorType = ImageInfo.COLOR_TYPE_RGB;
+        final String compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_RLE;
 
-        ImageInfo result = new ImageInfo(formatDetails, bitsPerPixel, comments,
+        final ImageInfo result = new ImageInfo(formatDetails, bitsPerPixel, comments,
                 format, name, height, mimeType, numberOfImages,
                 physicalHeightDpi, physicalHeightInch, physicalWidthDpi,
                 physicalWidthInch, width, isProgressive, isTransparent,
@@ -676,11 +676,11 @@ public class BmpImageParser extends Imag
     }
 
     @Override
-    public boolean dumpImageFile(PrintWriter pw, ByteSource byteSource)
+    public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource)
             throws ImageReadException, IOException {
         pw.println("bmp.dumpImageFile");
 
-        ImageInfo imageData = getImageInfo(byteSource, null);
+        final ImageInfo imageData = getImageInfo(byteSource, null);
 
         imageData.toString(pw, "");
 
@@ -690,11 +690,11 @@ public class BmpImageParser extends Imag
     }
 
     @Override
-    public FormatCompliance getFormatCompliance(ByteSource byteSource)
+    public FormatCompliance getFormatCompliance(final ByteSource byteSource)
             throws ImageReadException, IOException {
-        boolean verbose = false;
+        final boolean verbose = false;
 
-        FormatCompliance result = new FormatCompliance(
+        final FormatCompliance result = new FormatCompliance(
                 byteSource.getDescription());
 
         InputStream is = null;
@@ -705,7 +705,7 @@ public class BmpImageParser extends Imag
             if (is != null) {
                 try {
                     is.close();
-                } catch (IOException ignore) {
+                } catch (final IOException ignore) {
                     Debug.debug(ignore);
                 }
             }
@@ -715,7 +715,7 @@ public class BmpImageParser extends Imag
     }
 
     @Override
-    public BufferedImage getBufferedImage(ByteSource byteSource, Map<String,Object> params)
+    public BufferedImage getBufferedImage(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         InputStream is = null;
         try {
@@ -725,19 +725,19 @@ public class BmpImageParser extends Imag
             if (is != null) {
                 try {
                     is.close();
-                } catch (IOException ignore) {
+                } catch (final IOException ignore) {
                     Debug.debug(ignore);
                 }
             }
         }
     }
 
-    public BufferedImage getBufferedImage(InputStream inputStream, Map<String,Object> params)
+    public BufferedImage getBufferedImage(final InputStream inputStream, Map<String,Object> params)
             throws ImageReadException, IOException {
         // make copy of params; we'll clear keys as we consume them.
         params = (params == null) ? new HashMap<String,Object>() : new HashMap<String,Object>(params);
 
-        boolean verbose = ParamMap.getParamBoolean(params, PARAM_KEY_VERBOSE,
+        final boolean verbose = ParamMap.getParamBoolean(params, PARAM_KEY_VERBOSE,
                 false);
 
         if (params.containsKey(PARAM_KEY_VERBOSE)) {
@@ -748,22 +748,22 @@ public class BmpImageParser extends Imag
         }
 
         if (params.size() > 0) {
-            Object firstKey = params.keySet().iterator().next();
+            final Object firstKey = params.keySet().iterator().next();
             throw new ImageReadException("Unknown parameter: " + firstKey);
         }
 
-        ImageContents ic = readImageContents(inputStream,
+        final ImageContents ic = readImageContents(inputStream,
                 FormatCompliance.getDefault(), verbose);
         if (ic == null) {
             throw new ImageReadException("Couldn't read BMP Data");
         }
 
-        BmpHeaderInfo bhi = ic.bhi;
+        final BmpHeaderInfo bhi = ic.bhi;
         // byte colorTable[] = ic.colorTable;
         // byte imageData[] = ic.imageData;
 
-        int width = bhi.width;
-        int height = bhi.height;
+        final int width = bhi.width;
+        final int height = bhi.height;
 
         if (verbose) {
             System.out.println("width: " + width);
@@ -772,8 +772,8 @@ public class BmpImageParser extends Imag
             System.out.println("width*height*4: " + width * height * 4);
         }
 
-        PixelParser pixelParser = ic.pixelParser;
-        ImageBuilder imageBuilder = new ImageBuilder(width, height, true);
+        final PixelParser pixelParser = ic.pixelParser;
+        final ImageBuilder imageBuilder = new ImageBuilder(width, height, true);
         pixelParser.processImage(imageBuilder);
 
         return imageBuilder.getBufferedImage();
@@ -784,7 +784,7 @@ public class BmpImageParser extends Imag
     private static final int BITMAP_INFO_HEADER_SIZE = 40;
 
     @Override
-    public void writeImage(BufferedImage src, OutputStream os, Map<String,Object> params)
+    public void writeImage(final BufferedImage src, final OutputStream os, Map<String,Object> params)
             throws ImageWriteException, IOException {
         // make copy of params; we'll clear keys as we consume them.
         params = (params == null) ? new HashMap<String,Object>() : new HashMap<String,Object>(params);
@@ -800,7 +800,7 @@ public class BmpImageParser extends Imag
                     .remove(PARAM_KEY_PIXEL_DENSITY);
         }
         if (params.size() > 0) {
-            Object firstKey = params.keySet().iterator().next();
+            final Object firstKey = params.keySet().iterator().next();
             throw new ImageWriteException("Unknown parameter: " + firstKey);
         }
 
@@ -814,14 +814,14 @@ public class BmpImageParser extends Imag
             writer = new BmpWriterPalette(palette);
         }
 
-        byte imagedata[] = writer.getImageData(src);
-        BinaryOutputStream bos = new BinaryOutputStream(os, ByteOrder.INTEL);
+        final byte imagedata[] = writer.getImageData(src);
+        final BinaryOutputStream bos = new BinaryOutputStream(os, ByteOrder.INTEL);
 
         // write BitmapFileHeader
         os.write(0x42); // B, Windows 3.1x, 95, NT, Bitmap
         os.write(0x4d); // M
 
-        int filesize = BITMAP_FILE_HEADER_SIZE + BITMAP_INFO_HEADER_SIZE + // header
+        final int filesize = BITMAP_FILE_HEADER_SIZE + BITMAP_INFO_HEADER_SIZE + // header
                 // size
                 4 * writer.getPaletteSize() + // palette size in bytes
                 imagedata.length;
@@ -831,8 +831,8 @@ public class BmpImageParser extends Imag
         bos.write4Bytes(BITMAP_FILE_HEADER_SIZE + BITMAP_INFO_HEADER_SIZE
                 + 4 * writer.getPaletteSize()); // Bitmap Data Offset
 
-        int width = src.getWidth();
-        int height = src.getHeight();
+        final int width = src.getWidth();
+        final int height = src.getHeight();
 
         // write BitmapInfoHeader
         bos.write4Bytes(BITMAP_INFO_HEADER_SIZE); // Bitmap Info Header Size
@@ -872,7 +872,7 @@ public class BmpImageParser extends Imag
      * @return Xmp Xml as String, if present. Otherwise, returns null.
      */
     @Override
-    public String getXmpXml(ByteSource byteSource, Map<String,Object> params)
+    public String getXmpXml(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/ImageContents.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/ImageContents.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/ImageContents.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/ImageContents.java Tue Dec  4 17:23:16 2012
@@ -24,8 +24,8 @@ class ImageContents {
     public final byte imageData[];
     public final PixelParser pixelParser;
 
-    public ImageContents(BmpHeaderInfo bhi, byte ColorTable[],
-            byte ImageData[], PixelParser fPixelParser) {
+    public ImageContents(final BmpHeaderInfo bhi, final byte ColorTable[],
+            final byte ImageData[], final PixelParser fPixelParser) {
         this.bhi = bhi;
         this.colorTable = ColorTable;
         this.imageData = ImageData;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParser.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParser.java Tue Dec  4 17:23:16 2012
@@ -33,7 +33,7 @@ public abstract class PixelParser {
     protected final BinaryFileParser bfp;
     protected final ByteArrayInputStream is;
 
-    public PixelParser(BmpHeaderInfo bhi, byte ColorTable[], byte ImageData[]) {
+    public PixelParser(final BmpHeaderInfo bhi, final byte ColorTable[], final byte ImageData[]) {
         this.bhi = bhi;
         this.colorTable = ColorTable;
         this.imageData = ImageData;
@@ -47,12 +47,12 @@ public abstract class PixelParser {
 
     protected int getColorTableRGB(int index) {
         index *= 4;
-        int blue = 0xff & colorTable[index + 0];
-        int green = 0xff & colorTable[index + 1];
-        int red = 0xff & colorTable[index + 2];
-        int alpha = 0xff;
+        final int blue = 0xff & colorTable[index + 0];
+        final int green = 0xff & colorTable[index + 1];
+        final int red = 0xff & colorTable[index + 2];
+        final int alpha = 0xff;
 
-        int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
+        final int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
         return rgb;
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java Tue Dec  4 17:23:16 2012
@@ -33,8 +33,8 @@ public class PixelParserBitFields extend
     private final int blueMask;
     private final int alphaMask;
 
-    public PixelParserBitFields(BmpHeaderInfo bhi, byte ColorTable[],
-            byte ImageData[]) {
+    public PixelParserBitFields(final BmpHeaderInfo bhi, final byte ColorTable[],
+            final byte ImageData[]) {
         super(bhi, ColorTable, ImageData);
 
         redMask = bhi.redMask;
@@ -99,7 +99,7 @@ public class PixelParserBitFields extend
         blue = (blueShift >= 0) ? blue >> blueShift : blue << -blueShift;
         alpha = (alphaShift >= 0) ? alpha >> alphaShift : alpha << -alphaShift;
 
-        int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
+        final int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
 
         return rgb;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRgb.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRgb.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRgb.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRgb.java Tue Dec  4 17:23:16 2012
@@ -22,8 +22,8 @@ import org.apache.commons.imaging.ImageR
 import org.apache.commons.imaging.formats.bmp.BmpHeaderInfo;
 
 public class PixelParserRgb extends PixelParserSimple {
-    public PixelParserRgb(BmpHeaderInfo bhi, byte ColorTable[],
-            byte ImageData[]) {
+    public PixelParserRgb(final BmpHeaderInfo bhi, final byte ColorTable[],
+            final byte ImageData[]) {
         super(bhi, ColorTable, ImageData);
 
     }
@@ -50,53 +50,53 @@ public class PixelParserRgb extends Pixe
                 cached_byte = (0xff & imageData[bytecount]);
                 bytecount++;
             }
-            int cache_mask = (1 << bhi.bitsPerPixel) - 1;
-            int sample = cache_mask & (cached_byte >> (8 - bhi.bitsPerPixel));
+            final int cache_mask = (1 << bhi.bitsPerPixel) - 1;
+            final int sample = cache_mask & (cached_byte >> (8 - bhi.bitsPerPixel));
             cached_byte = 0xff & (cached_byte << bhi.bitsPerPixel);
             cached_bit_count -= bhi.bitsPerPixel;
 
-            int rgb = getColorTableRGB(sample);
+            final int rgb = getColorTableRGB(sample);
 
             return rgb;
         } else if (bhi.bitsPerPixel == 8) { // always grayscale?
-            int sample = 0xff & imageData[bytecount + 0];
+            final int sample = 0xff & imageData[bytecount + 0];
 
-            int rgb = getColorTableRGB(sample);
+            final int rgb = getColorTableRGB(sample);
 
             bytecount += 1;
 
             return rgb;
         } else if (bhi.bitsPerPixel == 16) {
-            int data = bfp.read2Bytes("Pixel", is, "BMP Image Data");
+            final int data = bfp.read2Bytes("Pixel", is, "BMP Image Data");
 
-            int blue = (0x1f & (data >> 0)) << 3;
-            int green = (0x1f & (data >> 5)) << 3;
-            int red = (0x1f & (data >> 10)) << 3;
-            int alpha = 0xff;
+            final int blue = (0x1f & (data >> 0)) << 3;
+            final int green = (0x1f & (data >> 5)) << 3;
+            final int red = (0x1f & (data >> 10)) << 3;
+            final int alpha = 0xff;
 
-            int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
+            final int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
 
             bytecount += 2;
 
             return rgb;
         } else if (bhi.bitsPerPixel == 24) {
-            int blue = 0xff & imageData[bytecount + 0];
-            int green = 0xff & imageData[bytecount + 1];
-            int red = 0xff & imageData[bytecount + 2];
-            int alpha = 0xff;
+            final int blue = 0xff & imageData[bytecount + 0];
+            final int green = 0xff & imageData[bytecount + 1];
+            final int red = 0xff & imageData[bytecount + 2];
+            final int alpha = 0xff;
 
-            int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
+            final int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
 
             bytecount += 3;
 
             return rgb;
         } else if (bhi.bitsPerPixel == 32) {
-            int blue = 0xff & imageData[bytecount + 0];
-            int green = 0xff & imageData[bytecount + 1];
-            int red = 0xff & imageData[bytecount + 2];
-            int alpha = 0xff;
+            final int blue = 0xff & imageData[bytecount + 0];
+            final int green = 0xff & imageData[bytecount + 1];
+            final int red = 0xff & imageData[bytecount + 2];
+            final int alpha = 0xff;
 
-            int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
+            final int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
 
             bytecount += 4;
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRle.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRle.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRle.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRle.java Tue Dec  4 17:23:16 2012
@@ -24,8 +24,8 @@ import org.apache.commons.imaging.format
 
 public class PixelParserRle extends PixelParser {
 
-    public PixelParserRle(BmpHeaderInfo bhi, byte ColorTable[],
-            byte ImageData[]) {
+    public PixelParserRle(final BmpHeaderInfo bhi, final byte ColorTable[],
+            final byte ImageData[]) {
         super(bhi, ColorTable, ImageData);
 
     }
@@ -41,7 +41,7 @@ public class PixelParserRle extends Pixe
         }
     }
 
-    private int[] convertDataToSamples(int data) throws ImageReadException {
+    private int[] convertDataToSamples(final int data) throws ImageReadException {
         int rgbs[];
         if (bhi.bitsPerPixel == 8) {
             rgbs = new int[1];
@@ -49,8 +49,8 @@ public class PixelParserRle extends Pixe
             // pixels_written = 1;
         } else if (bhi.bitsPerPixel == 4) {
             rgbs = new int[2];
-            int sample1 = data >> 4;
-            int sample2 = 0x0f & data;
+            final int sample1 = data >> 4;
+            final int sample2 = 0x0f & data;
             rgbs[0] = getColorTableRGB(sample1);
             rgbs[1] = getColorTableRGB(sample2);
             // pixels_written = 2;
@@ -62,8 +62,8 @@ public class PixelParserRle extends Pixe
         return rgbs;
     }
 
-    private int processByteOfData(int rgbs[], int repeat, int x, int y,
-            int width, int height, ImageBuilder imageBuilder) {
+    private int processByteOfData(final int rgbs[], final int repeat, int x, final int y,
+            final int width, final int height, final ImageBuilder imageBuilder) {
         // int rbg
         int pixels_written = 0;
         for (int i = 0; i < repeat; i++) {
@@ -71,7 +71,7 @@ public class PixelParserRle extends Pixe
             if ((x >= 0) && (x < width) && (y >= 0) && (y < height)) {
                 // int rgb = 0xff000000;
                 // rgb = getNextRGB();
-                int rgb = rgbs[i % rgbs.length];
+                final int rgb = rgbs[i % rgbs.length];
                 // bi.setRGB(x, y, rgb);
                 imageBuilder.setRGB(x, y, rgb);
                 // bi.setRGB(x, y, 0xff00ff00);
@@ -87,17 +87,17 @@ public class PixelParserRle extends Pixe
     }
 
     @Override
-    public void processImage(ImageBuilder imageBuilder)
+    public void processImage(final ImageBuilder imageBuilder)
             throws ImageReadException, IOException {
-        int width = bhi.width;
-        int height = bhi.height;
+        final int width = bhi.width;
+        final int height = bhi.height;
         int x = 0, y = height - 1;
 
         boolean done = false;
         while (!done) {
-            int a = 0xff & bfp.readByte("RLE (" + x + "," + y + ") a", is,
+            final int a = 0xff & bfp.readByte("RLE (" + x + "," + y + ") a", is,
                     "BMP: Bad RLE");
-            int b = 0xff & bfp.readByte("RLE (" + x + "," + y + ") b", is,
+            final int b = 0xff & bfp.readByte("RLE (" + x + "," + y + ") b", is,
                     "BMP: Bad RLE");
 
             if (a == 0) {
@@ -113,14 +113,14 @@ public class PixelParserRle extends Pixe
                     done = true;
                     break;
                 case 2: {
-                    int deltaX = 0xff & bfp.readByte("RLE deltaX", is, "BMP: Bad RLE");
-                    int deltaY = 0xff & bfp.readByte("RLE deltaY", is, "BMP: Bad RLE");
+                    final int deltaX = 0xff & bfp.readByte("RLE deltaX", is, "BMP: Bad RLE");
+                    final int deltaY = 0xff & bfp.readByte("RLE deltaY", is, "BMP: Bad RLE");
                     x += deltaX;
                     y -= deltaY;
                     break;
                 }
                 default: {
-                    int SamplesPerByte = getSamplesPerByte();
+                    final int SamplesPerByte = getSamplesPerByte();
                     int size = b / SamplesPerByte;
                     if ((b % SamplesPerByte) > 0) {
                         size++;
@@ -133,20 +133,20 @@ public class PixelParserRle extends Pixe
                     // System.out.println("size: " + size);
                     // System.out.println("SamplesPerByte: " + SamplesPerByte);
 
-                    byte bytes[] = bfp.readByteArray("bytes", size, is,
+                    final byte bytes[] = bfp.readByteArray("bytes", size, is,
                             "RLE: Absolute Mode");
 
                     int remaining = b;
 
                     for (int i = 0; remaining > 0; i++) {
                     // for (int i = 0; i < bytes.length; i++)
-                        int samples[] = convertDataToSamples(0xff & bytes[i]);
-                        int towrite = Math.min(remaining, SamplesPerByte);
+                        final int samples[] = convertDataToSamples(0xff & bytes[i]);
+                        final int towrite = Math.min(remaining, SamplesPerByte);
                         // System.out.println("remaining: " + remaining);
                         // System.out.println("SamplesPerByte: "
                         // + SamplesPerByte);
                         // System.out.println("towrite: " + towrite);
-                        int written = processByteOfData(samples, towrite, x, y,
+                        final int written = processByteOfData(samples, towrite, x, y,
                                 width, height, imageBuilder);
                         // System.out.println("written: " + written);
                         // System.out.println("");
@@ -157,7 +157,7 @@ public class PixelParserRle extends Pixe
                 }
                 }
             } else {
-                int rgbs[] = convertDataToSamples(b);
+                final int rgbs[] = convertDataToSamples(b);
 
                 x += processByteOfData(rgbs, a, x, y, width, height,
                         imageBuilder);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserSimple.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserSimple.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserSimple.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserSimple.java Tue Dec  4 17:23:16 2012
@@ -23,8 +23,8 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.formats.bmp.BmpHeaderInfo;
 
 public abstract class PixelParserSimple extends PixelParser {
-    public PixelParserSimple(BmpHeaderInfo bhi, byte ColorTable[],
-            byte ImageData[]) {
+    public PixelParserSimple(final BmpHeaderInfo bhi, final byte ColorTable[],
+            final byte ImageData[]) {
         super(bhi, ColorTable, ImageData);
     }
 
@@ -33,13 +33,13 @@ public abstract class PixelParserSimple 
     public abstract void newline() throws ImageReadException, IOException;
 
     @Override
-    public void processImage(ImageBuilder imageBuilder)
+    public void processImage(final ImageBuilder imageBuilder)
             throws ImageReadException, IOException {
         // DataBuffer db = bi.getRaster().getDataBuffer();
 
         for (int y = bhi.height - 1; y >= 0; y--) {
             for (int x = 0; x < bhi.width; x++) {
-                int rgb = getNextRGB();
+                final int rgb = getNextRGB();
 
                 imageBuilder.setRGB(x, y, rgb);
                 // db.setElem(y * bhi.width + x, rgb);



Mime
View raw message