commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1417043 [4/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/BinaryInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryInputStream.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryInputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryInputStream.java Tue Dec  4 17:23:16 2012
@@ -26,7 +26,7 @@ import org.apache.commons.imaging.ImageR
 public class BinaryInputStream extends InputStream {
     protected boolean debug = false;
 
-    public final void setDebug(boolean b) {
+    public final void setDebug(final boolean b) {
         debug = b;
     }
 
@@ -36,24 +36,24 @@ public class BinaryInputStream extends I
 
     private final InputStream is;
 
-    public BinaryInputStream(byte bytes[], ByteOrder byteOrder) {
+    public BinaryInputStream(final byte bytes[], final ByteOrder byteOrder) {
         this.byteOrder = byteOrder;
         this.is = new ByteArrayInputStream(bytes);
     }
 
-    public BinaryInputStream(InputStream is, ByteOrder byteOrder) {
+    public BinaryInputStream(final InputStream is, final ByteOrder byteOrder) {
         this.byteOrder = byteOrder;
         this.is = is;
     }
 
-    public BinaryInputStream(InputStream is) {
+    public BinaryInputStream(final InputStream is) {
         this.is = is;
     }
 
     // default byte order for Java, many file formats.
     private ByteOrder byteOrder = ByteOrder.NETWORK;
 
-    protected void setByteOrder(ByteOrder byteOrder) {
+    protected void setByteOrder(final ByteOrder byteOrder) {
         this.byteOrder = byteOrder;
     }
 
@@ -66,30 +66,30 @@ public class BinaryInputStream extends I
         return is.read();
     }
 
-    protected final int convertByteArrayToInt(String name, byte bytes[]) {
+    protected final int convertByteArrayToInt(final String name, final byte bytes[]) {
         return convertByteArrayToInt(name, bytes, byteOrder);
     }
 
-    public final int convertByteArrayToShort(String name, byte bytes[]) {
+    public final int convertByteArrayToShort(final String name, final byte bytes[]) {
         return convertByteArrayToShort(name, bytes, byteOrder);
     }
 
-    public final int convertByteArrayToShort(String name, int start,
-            byte bytes[]) {
+    public final int convertByteArrayToShort(final String name, final int start,
+            final byte bytes[]) {
         return convertByteArrayToShort(name, start, bytes, byteOrder);
     }
 
-    public final int read4Bytes(String name, String exception)
+    public final int read4Bytes(final String name, final String exception)
             throws IOException {
         return read4Bytes(name, exception, byteOrder);
     }
 
-    public final int read3Bytes(String name, String exception)
+    public final int read3Bytes(final String name, final String exception)
             throws IOException {
         return read3Bytes(name, exception, byteOrder);
     }
 
-    public final int read2Bytes(String name, String exception)
+    public final int read2Bytes(final String name, final String exception)
             throws IOException {
         return read2Bytes(name, exception, byteOrder);
     }
@@ -101,18 +101,18 @@ public class BinaryInputStream extends I
         }
     }
 
-    public final void debugNumber(String msg, int data) {
+    public final void debugNumber(final String msg, final int data) {
         debugNumber(msg, data, 1);
     }
 
-    public final void debugNumber(String msg, int data, int bytes) {
+    public final void debugNumber(final String msg, final int data, final int bytes) {
         System.out.print(msg + ": " + data + " (");
         int byteData = data;
         for (int i = 0; i < bytes; i++) {
             if (i > 0) {
                 System.out.print(",");
             }
-            int singleByte = 0xff & byteData;
+            final int singleByte = 0xff & byteData;
             System.out.print((char) singleByte + " [" + singleByte + "]");
             byteData >>= 8;
         }
@@ -120,11 +120,11 @@ public class BinaryInputStream extends I
                 + Integer.toBinaryString(data) + "]");
     }
 
-    public final void readAndVerifyBytes(byte expected[], String exception)
+    public final void readAndVerifyBytes(final byte expected[], final String exception)
             throws ImageReadException, IOException {
         for (int i = 0; i < expected.length; i++) {
-            int data = is.read();
-            byte b = (byte) (0xff & data);
+            final int data = is.read();
+            final byte b = (byte) (0xff & data);
 
             if ((data < 0) || (b != expected[i])) {
                 System.out.println("i" + ": " + i);
@@ -138,9 +138,9 @@ public class BinaryInputStream extends I
         }
     }
 
-    protected final void readAndVerifyBytes(String name, byte expected[],
-            String exception) throws ImageReadException, IOException {
-        byte bytes[] = readByteArray(name, expected.length, exception);
+    protected final void readAndVerifyBytes(final String name, final byte expected[],
+            final String exception) throws ImageReadException, IOException {
+        final byte bytes[] = readByteArray(name, expected.length, exception);
 
         for (int i = 0; i < expected.length; i++) {
             if (bytes[i] != expected[i]) {
@@ -153,11 +153,11 @@ public class BinaryInputStream extends I
         }
     }
 
-    public final void skipBytes(int length, String exception)
+    public final void skipBytes(final int length, final String exception)
             throws IOException {
         long total = 0;
         while (length != total) {
-            long skipped = is.skip(length - total);
+            final long skipped = is.skip(length - total);
             if (skipped < 1) {
                 throw new IOException(exception + " (" + skipped + ")");
             }
@@ -165,10 +165,10 @@ public class BinaryInputStream extends I
         }
     }
 
-    protected final void scanForByte(byte value) throws IOException {
+    protected final void scanForByte(final byte value) throws IOException {
         int count = 0;
         for (int i = 0; count < 3; i++) {
-            int b = is.read();
+            final int b = is.read();
             if (b < 0) {
                 return;
             }
@@ -179,9 +179,9 @@ public class BinaryInputStream extends I
         }
     }
 
-    public final byte readByte(String name, String exception)
+    public final byte readByte(final String name, final String exception)
             throws IOException {
-        int result = is.read();
+        final int result = is.read();
 
         if ((result < 0)) {
             System.out.println(name + ": " + result);
@@ -196,8 +196,8 @@ public class BinaryInputStream extends I
     }
 
     protected final RationalNumber[] convertByteArrayToRationalArray(
-            String name, byte bytes[], int start, int length, ByteOrder byteOrder) {
-        int expectedLength = start + length * 8;
+            final String name, final byte bytes[], final int start, final int length, final ByteOrder byteOrder) {
+        final int expectedLength = start + length * 8;
 
         if (bytes.length < expectedLength) {
             System.out.println(name + ": expected length: " + expectedLength
@@ -205,7 +205,7 @@ public class BinaryInputStream extends I
             return null;
         }
 
-        RationalNumber result[] = new RationalNumber[length];
+        final RationalNumber result[] = new RationalNumber[length];
 
         for (int i = 0; i < length; i++) {
             result[i] = convertByteArrayToRational(name, bytes, start + i * 8,
@@ -215,31 +215,31 @@ public class BinaryInputStream extends I
         return result;
     }
 
-    protected final RationalNumber convertByteArrayToRational(String name,
-            byte bytes[], ByteOrder byteOrder) {
+    protected final RationalNumber convertByteArrayToRational(final String name,
+            final byte bytes[], final ByteOrder byteOrder) {
         return convertByteArrayToRational(name, bytes, 0, byteOrder);
     }
 
-    protected final RationalNumber convertByteArrayToRational(String name,
-            byte bytes[], int start, ByteOrder byteOrder) {
-        int numerator = convertByteArrayToInt(name, bytes, start + 0, 4,
+    protected final RationalNumber convertByteArrayToRational(final String name,
+            final byte bytes[], final int start, final ByteOrder byteOrder) {
+        final int numerator = convertByteArrayToInt(name, bytes, start + 0, 4,
                 byteOrder);
-        int divisor = convertByteArrayToInt(name, bytes, start + 4, 4,
+        final int divisor = convertByteArrayToInt(name, bytes, start + 4, 4,
                 byteOrder);
 
         return new RationalNumber(numerator, divisor);
     }
 
-    protected final int convertByteArrayToInt(String name, byte bytes[],
-            ByteOrder byteOrder) {
+    protected final int convertByteArrayToInt(final String name, final byte bytes[],
+            final ByteOrder byteOrder) {
         return convertByteArrayToInt(name, bytes, 0, 4, byteOrder);
     }
 
-    protected final int convertByteArrayToInt(String name, byte bytes[],
-            int start, int length, ByteOrder byteOrder) {
-        byte byte0 = bytes[start + 0];
-        byte byte1 = bytes[start + 1];
-        byte byte2 = bytes[start + 2];
+    protected final int convertByteArrayToInt(final String name, final byte bytes[],
+            final int start, final int length, final ByteOrder byteOrder) {
+        final byte byte0 = bytes[start + 0];
+        final byte byte1 = bytes[start + 1];
+        final byte byte2 = bytes[start + 2];
         byte byte3 = 0;
         if (length == 4) {
             byte3 = bytes[start + 3];
@@ -262,9 +262,9 @@ public class BinaryInputStream extends I
         return result;
     }
 
-    protected final int[] convertByteArrayToIntArray(String name, byte bytes[],
-            int start, int length, ByteOrder byteOrder) {
-        int expectedLength = start + length * 4;
+    protected final int[] convertByteArrayToIntArray(final String name, final byte bytes[],
+            final int start, final int length, final ByteOrder byteOrder) {
+        final int expectedLength = start + length * 4;
 
         if (bytes.length < expectedLength) {
             System.out.println(name + ": expected length: " + expectedLength
@@ -272,7 +272,7 @@ public class BinaryInputStream extends I
             return null;
         }
 
-        int result[] = new int[length];
+        final int result[] = new int[length];
 
         for (int i = 0; i < length; i++) {
             result[i] = convertByteArrayToInt(name, bytes, start + i * 4, 4,
@@ -282,15 +282,15 @@ public class BinaryInputStream extends I
         return result;
     }
 
-    protected final int convertByteArrayToShort(String name, byte bytes[],
-            ByteOrder byteOrder) {
+    protected final int convertByteArrayToShort(final String name, final byte bytes[],
+            final ByteOrder byteOrder) {
         return convertByteArrayToShort(name, 0, bytes, byteOrder);
     }
 
-    protected final int convertByteArrayToShort(String name, int start,
-            byte bytes[], ByteOrder byteOrder) {
-        byte byte0 = bytes[start + 0];
-        byte byte1 = bytes[start + 1];
+    protected final int convertByteArrayToShort(final String name, final int start,
+            final byte bytes[], final ByteOrder byteOrder) {
+        final byte byte0 = bytes[start + 0];
+        final byte byte1 = bytes[start + 1];
 
         int result;
 
@@ -307,9 +307,9 @@ public class BinaryInputStream extends I
         return result;
     }
 
-    protected final int[] convertByteArrayToShortArray(String name,
-            byte bytes[], int start, int length, ByteOrder byteOrder) {
-        int expectedLength = start + length * 2;
+    protected final int[] convertByteArrayToShortArray(final String name,
+            final byte bytes[], final int start, final int length, final ByteOrder byteOrder) {
+        final int expectedLength = start + length * 2;
 
         if (bytes.length < expectedLength) {
             System.out.println(name + ": expected length: " + expectedLength
@@ -317,7 +317,7 @@ public class BinaryInputStream extends I
             return null;
         }
 
-        int result[] = new int[length];
+        final int result[] = new int[length];
 
         for (int i = 0; i < length; i++) {
             result[i] = convertByteArrayToShort(name, start + i * 2, bytes,
@@ -331,13 +331,13 @@ public class BinaryInputStream extends I
         return result;
     }
 
-    public final byte[] readByteArray(String name, int length, String exception)
+    public final byte[] readByteArray(final String name, final int length, final String exception)
             throws IOException {
-        byte result[] = new byte[length];
+        final byte result[] = new byte[length];
 
         int read = 0;
         while (read < length) {
-            int count = is.read(result, read, length - read);
+            final int count = is.read(result, read, length - read);
             if (count < 1) {
                 throw new IOException(exception);
             }
@@ -353,7 +353,7 @@ public class BinaryInputStream extends I
         return result;
     }
 
-    protected final void debugByteArray(String name, byte bytes[]) {
+    protected final void debugByteArray(final String name, final byte bytes[]) {
         System.out.println(name + ": " + bytes.length);
 
         for (int i = 0; ((i < bytes.length) && (i < 50)); i++) {
@@ -361,7 +361,7 @@ public class BinaryInputStream extends I
         }
     }
 
-    protected final void debugNumberArray(String name, int numbers[], int length) {
+    protected final void debugNumberArray(final String name, final int numbers[], final int length) {
         System.out.println(name + ": " + numbers.length);
 
         for (int i = 0; ((i < numbers.length) && (i < 50)); i++) {
@@ -369,13 +369,13 @@ public class BinaryInputStream extends I
         }
     }
 
-    public final byte[] readBytearray(String name, byte bytes[], int start,
-            int count) {
+    public final byte[] readBytearray(final String name, final byte bytes[], final int start,
+            final int count) {
         if (bytes.length < (start + count)) {
             return null;
         }
 
-        byte result[] = new byte[count];
+        final byte result[] = new byte[count];
         System.arraycopy(bytes, start, result, 0, count);
 
         if (debug) {
@@ -385,17 +385,17 @@ public class BinaryInputStream extends I
         return result;
     }
 
-    public final byte[] readByteArray(int length, String error)
+    public final byte[] readByteArray(final int length, final String error)
             throws ImageReadException, IOException {
-        boolean verbose = false;
-        boolean strict = true;
+        final boolean verbose = false;
+        final boolean strict = true;
         return readByteArray(length, error, verbose, strict);
     }
 
-    public final byte[] readByteArray(int length, String error,
-            boolean verbose, boolean strict) throws ImageReadException,
+    public final byte[] readByteArray(final int length, final String error,
+            final boolean verbose, final boolean strict) throws ImageReadException,
             IOException {
-        byte bytes[] = new byte[length];
+        final byte bytes[] = new byte[length];
         int total = 0;
         int read;
         while ((read = read(bytes, total, length - total)) > 0) {
@@ -412,16 +412,16 @@ public class BinaryInputStream extends I
         return bytes;
     }
 
-    protected final byte[] getBytearrayTail(String name, byte bytes[], int count) {
+    protected final byte[] getBytearrayTail(final String name, final byte bytes[], final int count) {
         return readBytearray(name, bytes, count, bytes.length - count);
     }
 
-    protected final byte[] getBytearrayHead(String name, byte bytes[], int count) {
+    protected final byte[] getBytearrayHead(final String name, final byte bytes[], final int count) {
         return readBytearray(name, bytes, 0, bytes.length - count);
     }
 
-    public final boolean compareByteArrays(byte a[], int aStart, byte b[],
-            int bStart, int length) {
+    public final boolean compareByteArrays(final byte a[], final int aStart, final byte b[],
+            final int bStart, final int length) {
         if (a.length < (aStart + length)) {
             return false;
         }
@@ -441,14 +441,14 @@ public class BinaryInputStream extends I
         return true;
     }
 
-    protected final int read4Bytes(String name, String exception, ByteOrder byteOrder)
+    protected final int read4Bytes(final String name, final String exception, final ByteOrder byteOrder)
             throws IOException {
-        int size = 4;
-        byte bytes[] = new byte[size];
+        final int size = 4;
+        final byte bytes[] = new byte[size];
 
         int read = 0;
         while (read < size) {
-            int count = is.read(bytes, read, size - read);
+            final int count = is.read(bytes, read, size - read);
             if (count < 1) {
                 throw new IOException(exception);
             }
@@ -459,14 +459,14 @@ public class BinaryInputStream extends I
         return convertByteArrayToInt(name, bytes, byteOrder);
     }
 
-    protected final int read3Bytes(String name, String exception, ByteOrder byteOrder)
+    protected final int read3Bytes(final String name, final String exception, final ByteOrder byteOrder)
             throws IOException {
-        int size = 3;
-        byte bytes[] = new byte[size];
+        final int size = 3;
+        final byte bytes[] = new byte[size];
 
         int read = 0;
         while (read < size) {
-            int count = is.read(bytes, read, size - read);
+            final int count = is.read(bytes, read, size - read);
             if (count < 1) {
                 throw new IOException(exception);
             }
@@ -478,14 +478,14 @@ public class BinaryInputStream extends I
 
     }
 
-    protected final int read2Bytes(String name, String exception, ByteOrder byteOrder)
+    protected final int read2Bytes(final String name, final String exception, final ByteOrder byteOrder)
             throws IOException {
-        int size = 2;
-        byte bytes[] = new byte[size];
+        final int size = 2;
+        final byte bytes[] = new byte[size];
 
         int read = 0;
         while (read < size) {
-            int count = is.read(bytes, read, size - read);
+            final int count = is.read(bytes, read, size - read);
             if (count < 1) {
                 throw new IOException(exception);
             }
@@ -496,9 +496,9 @@ public class BinaryInputStream extends I
         return convertByteArrayToShort(name, bytes, byteOrder);
     }
 
-    public final int read1ByteInteger(String exception)
+    public final int read1ByteInteger(final String exception)
             throws ImageReadException, IOException {
-        int byte0 = is.read();
+        final int byte0 = is.read();
         if (byte0 < 0) {
             throw new ImageReadException(exception);
         }
@@ -506,10 +506,10 @@ public class BinaryInputStream extends I
         return 0xff & byte0;
     }
 
-    public final int read2ByteInteger(String exception)
+    public final int read2ByteInteger(final String exception)
             throws ImageReadException, IOException {
-        int byte0 = is.read();
-        int byte1 = is.read();
+        final int byte0 = is.read();
+        final int byte1 = is.read();
         if (byte0 < 0 || byte1 < 0) {
             throw new ImageReadException(exception);
         }
@@ -521,12 +521,12 @@ public class BinaryInputStream extends I
         }
     }
 
-    public final int read4ByteInteger(String exception)
+    public final int read4ByteInteger(final String exception)
             throws ImageReadException, IOException {
-        int byte0 = is.read();
-        int byte1 = is.read();
-        int byte2 = is.read();
-        int byte3 = is.read();
+        final int byte0 = is.read();
+        final int byte1 = is.read();
+        final int byte2 = is.read();
+        final int byte3 = is.read();
         if (byte0 < 0 || byte1 < 0 || byte2 < 0 || byte3 < 0) {
             throw new ImageReadException(exception);
         }
@@ -540,25 +540,25 @@ public class BinaryInputStream extends I
         }
     }
 
-    protected final void printCharQuad(String msg, int i) {
+    protected final void printCharQuad(final String msg, final int i) {
         System.out.println(msg + ": '" + (char) (0xff & (i >> 24))
                 + (char) (0xff & (i >> 16)) + (char) (0xff & (i >> 8))
                 + (char) (0xff & (i >> 0)) + "'");
     }
 
-    protected final void printByteBits(String msg, byte i) {
+    protected final void printByteBits(final String msg, final byte i) {
         System.out.println(msg + ": '" + Integer.toBinaryString(0xff & i));
     }
 
-    protected final static int charsToQuad(char c1, char c2, char c3, char c4) {
+    protected final static int charsToQuad(final char c1, final char c2, final char c3, final char c4) {
         return (((0xff & c1) << 24) | ((0xff & c2) << 16) | ((0xff & c3) << 8) | ((0xff & c4) << 0));
     }
 
-    public final int findNull(byte src[]) {
+    public final int findNull(final byte src[]) {
         return findNull(src, 0);
     }
 
-    public final int findNull(byte src[], int start) {
+    public final int findNull(final byte src[], final int start) {
         for (int i = start; i < src.length; i++) {
             if (src[i] == 0) {
                 return i;
@@ -567,9 +567,9 @@ public class BinaryInputStream extends I
         return -1;
     }
 
-    protected final byte[] getRAFBytes(RandomAccessFile raf, long pos,
-            int length, String exception) throws IOException {
-        byte result[] = new byte[length];
+    protected final byte[] getRAFBytes(final RandomAccessFile raf, final long pos,
+            final int length, final String exception) throws IOException {
+        final byte result[] = new byte[length];
 
         if (debug) {
             System.out.println("getRAFBytes pos" + ": " + pos);
@@ -580,7 +580,7 @@ public class BinaryInputStream extends I
 
         int read = 0;
         while (read < length) {
-            int count = raf.read(result, read, length - read);
+            final int count = raf.read(result, read, length - read);
             if (count < 1) {
                 throw new IOException(exception);
             }
@@ -592,7 +592,7 @@ public class BinaryInputStream extends I
 
     }
 
-    protected void skipBytes(int length) throws IOException {
+    protected void skipBytes(final int length) throws IOException {
         skipBytes(length, "Couldn't skip bytes");
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java Tue Dec  4 17:23:16 2012
@@ -23,7 +23,7 @@ public class BinaryOutputStream extends 
     protected boolean debug = false;
     private int count = 0;
 
-    public final void setDebug(boolean b) {
+    public final void setDebug(final boolean b) {
         debug = b;
     }
 
@@ -33,19 +33,19 @@ public class BinaryOutputStream extends 
 
     private final OutputStream os;
 
-    public BinaryOutputStream(OutputStream os, ByteOrder byteOrder) {
+    public BinaryOutputStream(final OutputStream os, final ByteOrder byteOrder) {
         this.byteOrder = byteOrder;
         this.os = os;
     }
 
-    public BinaryOutputStream(OutputStream os) {
+    public BinaryOutputStream(final OutputStream os) {
         this.os = os;
     }
 
     // default byte order for Java, many file formats.
     private ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
 
-    protected void setByteOrder(ByteOrder byteOrder) {
+    protected void setByteOrder(final ByteOrder byteOrder) {
         this.byteOrder = byteOrder;
     }
 
@@ -54,7 +54,7 @@ public class BinaryOutputStream extends 
     }
 
     @Override
-    public void write(int i) throws IOException {
+    public void write(final int i) throws IOException {
         os.write(i);
         count++;
     }
@@ -63,19 +63,19 @@ public class BinaryOutputStream extends 
         return count;
     }
 
-    public final void write4Bytes(int value) throws IOException {
+    public final void write4Bytes(final int value) throws IOException {
         writeNBytes(value, 4);
     }
 
-    public final void write3Bytes(int value) throws IOException {
+    public final void write3Bytes(final int value) throws IOException {
         writeNBytes(value, 3);
     }
 
-    public final void write2Bytes(int value) throws IOException {
+    public final void write2Bytes(final int value) throws IOException {
         writeNBytes(value, 2);
     }
 
-    public final void write4ByteInteger(int value) throws IOException {
+    public final void write4ByteInteger(final int value) throws IOException {
         if (byteOrder == ByteOrder.MOTOROLA) {
             write(0xff & (value >> 24));
             write(0xff & (value >> 16));
@@ -89,7 +89,7 @@ public class BinaryOutputStream extends 
         }
     }
 
-    public final void write2ByteInteger(int value) throws IOException {
+    public final void write2ByteInteger(final int value) throws IOException {
         if (byteOrder == ByteOrder.MOTOROLA) {
             write(0xff & (value >> 8));
             write(0xff & value);
@@ -99,22 +99,22 @@ public class BinaryOutputStream extends 
         }
     }
 
-    public final void writeByteArray(byte bytes[]) throws IOException {
+    public final void writeByteArray(final byte bytes[]) throws IOException {
         os.write(bytes, 0, bytes.length);
         count += bytes.length;
     }
 
-    private byte[] convertValueToByteArray(int value, int n) {
-        byte result[] = new byte[n];
+    private byte[] convertValueToByteArray(final int value, final int n) {
+        final byte result[] = new byte[n];
 
         if (byteOrder == ByteOrder.MOTOROLA) {
             for (int i = 0; i < n; i++) {
-                int b = 0xff & (value >> (8 * (n - i - 1)));
+                final int b = 0xff & (value >> (8 * (n - i - 1)));
                 result[i] = (byte) b;
             }
         } else {
             for (int i = 0; i < n; i++) {
-                int b = 0xff & (value >> (8 * i));
+                final int b = 0xff & (value >> (8 * i));
                 result[i] = (byte) b;
             }
         }
@@ -122,7 +122,7 @@ public class BinaryOutputStream extends 
         return result;
     }
 
-    private final void writeNBytes(int value, int n) throws IOException {
+    private final void writeNBytes(final int value, final int n) throws IOException {
         write(convertValueToByteArray(value, n));
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitArrayOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitArrayOutputStream.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitArrayOutputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitArrayOutputStream.java Tue Dec  4 17:23:16 2012
@@ -26,7 +26,7 @@ public class BitArrayOutputStream {
         buffer = new byte[16];
     }
 
-    public BitArrayOutputStream(int size) {
+    public BitArrayOutputStream(final int size) {
         buffer = new byte[size];
     }
 
@@ -39,7 +39,7 @@ public class BitArrayOutputStream {
         if (bytesWritten == buffer.length) {
             return buffer;
         }
-        byte[] out = new byte[bytesWritten];
+        final byte[] out = new byte[bytesWritten];
         System.arraycopy(buffer, 0, out, 0, bytesWritten);
         return out;
     }
@@ -56,12 +56,12 @@ public class BitArrayOutputStream {
         }
     }
 
-    public void write(int b) {
+    public void write(final int b) {
         flush();
         writeByte(b);
     }
 
-    public void writeBit(int bit) {
+    public void writeBit(final int bit) {
         if (bit != 0) {
             cache |= cacheMask;
         }
@@ -79,9 +79,9 @@ public class BitArrayOutputStream {
         return count;
     }
 
-    private void writeByte(int b) {
+    private void writeByte(final int b) {
         if (bytesWritten >= buffer.length) {
-            byte[] bigger = new byte[buffer.length * 2];
+            final byte[] bigger = new byte[buffer.length * 2];
             System.arraycopy(buffer, 0, bigger, 0, bytesWritten);
             buffer = bigger;
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStream.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStream.java Tue Dec  4 17:23:16 2012
@@ -24,7 +24,7 @@ public class BitInputStream extends Inpu
     private final InputStream is;
     private final ByteOrder byteOrder;
 
-    public BitInputStream(InputStream is, ByteOrder byteOrder) {
+    public BitInputStream(final InputStream is, final ByteOrder byteOrder) {
         this.is = is;
         this.byteOrder = byteOrder;
     }
@@ -41,7 +41,7 @@ public class BitInputStream extends Inpu
     private int cacheBitsRemaining = 0;
     private long bytes_read = 0;
 
-    public final int readBits(int count) throws IOException {
+    public final int readBits(final int count) throws IOException {
         if (count < 8) {
             if (cacheBitsRemaining == 0) {
                 // fill cache
@@ -56,7 +56,7 @@ public class BitInputStream extends Inpu
 
             // int bits_to_shift = cache_bits_remaining - count;
             cacheBitsRemaining -= count;
-            int bits = cache >> cacheBitsRemaining;
+            final int bits = cache >> cacheBitsRemaining;
 
             switch (count) {
             case 1:

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStreamFlexible.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStreamFlexible.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStreamFlexible.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStreamFlexible.java Tue Dec  4 17:23:16 2012
@@ -24,7 +24,7 @@ public class BitInputStreamFlexible exte
     // samples size<8 - shuoldn't that effect their order within byte?
     private final InputStream is;
 
-    public BitInputStreamFlexible(InputStream is) {
+    public BitInputStreamFlexible(final InputStream is) {
         this.is = is;
         // super(is);
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/Compression.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/Compression.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/Compression.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/Compression.java Tue Dec  4 17:23:16 2012
@@ -26,31 +26,31 @@ import org.apache.commons.imaging.common
 
 public class Compression {
 
-    public byte[] decompressLZW(byte compressed[], int LZWMinimumCodeSize,
-            int expectedSize, ByteOrder byteOrder) throws IOException {
-        InputStream is = new ByteArrayInputStream(compressed);
+    public byte[] decompressLZW(final byte compressed[], final int LZWMinimumCodeSize,
+            final int expectedSize, final ByteOrder byteOrder) throws IOException {
+        final InputStream is = new ByteArrayInputStream(compressed);
 
-        MyLzwDecompressor decompressor = new MyLzwDecompressor(
+        final MyLzwDecompressor decompressor = new MyLzwDecompressor(
                 LZWMinimumCodeSize, byteOrder);
-        byte[] result = decompressor.decompress(is, expectedSize);
+        final byte[] result = decompressor.decompress(is, expectedSize);
 
         return result;
     }
 
-    public byte[] decompressPackBits(byte compressed[], int expectedSize,
-            ByteOrder byteOrder) throws ImageReadException {
-        byte unpacked[] = new PackBits().decompress(compressed, expectedSize);
+    public byte[] decompressPackBits(final byte compressed[], final int expectedSize,
+            final ByteOrder byteOrder) throws ImageReadException {
+        final byte unpacked[] = new PackBits().decompress(compressed, expectedSize);
         return unpacked;
     }
 
-    public byte[] compressLZW(byte src[], int LZWMinimumCodeSize,
-            ByteOrder byteOrder, boolean earlyLimit) throws IOException
+    public byte[] compressLZW(final byte src[], final int LZWMinimumCodeSize,
+            final ByteOrder byteOrder, final boolean earlyLimit) throws IOException
 
     {
-        MyLzwCompressor compressor = new MyLzwCompressor(LZWMinimumCodeSize,
+        final MyLzwCompressor compressor = new MyLzwCompressor(LZWMinimumCodeSize,
                 byteOrder, earlyLimit);
 
-        byte compressed[] = compressor.compress(src);
+        final byte compressed[] = compressor.compress(src);
 
         return compressed;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageBuilder.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageBuilder.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageBuilder.java Tue Dec  4 17:23:16 2012
@@ -29,7 +29,7 @@ public class ImageBuilder {
     private final int height;
     private final boolean hasAlpha;
 
-    public ImageBuilder(int width, int height, boolean hasAlpha) {
+    public ImageBuilder(final int width, final int height, final boolean hasAlpha) {
         data = new int[width * height];
         this.width = width;
         this.height = height;
@@ -44,12 +44,12 @@ public class ImageBuilder {
         return height;
     }
 
-    public int getRGB(int x, int y) {
+    public int getRGB(final int x, final int y) {
         final int rowOffset = y * width;
         return data[rowOffset + x];
     }
 
-    public void setRGB(int x, int y, int argb) {
+    public void setRGB(final int x, final int y, final int argb) {
         final int rowOffset = y * width;
         data[rowOffset + x] = argb;
     }
@@ -57,7 +57,7 @@ public class ImageBuilder {
     public BufferedImage getBufferedImage() {
         ColorModel colorModel;
         WritableRaster raster;
-        DataBufferInt buffer = new DataBufferInt(data, width * height);
+        final DataBufferInt buffer = new DataBufferInt(data, width * height);
         if (hasAlpha) {
             colorModel = new DirectColorModel(32, 0x00ff0000, 0x0000ff00,
                     0x000000ff, 0xff000000);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java Tue Dec  4 17:23:16 2012
@@ -22,11 +22,11 @@ import java.util.List;
 public class ImageMetadata implements IImageMetadata {
     private final List<IImageMetadataItem> items = new ArrayList<IImageMetadataItem>();
 
-    public void add(String keyword, String text) {
+    public void add(final String keyword, final String text) {
         add(new Item(keyword, text));
     }
 
-    public void add(IImageMetadataItem item) {
+    public void add(final IImageMetadataItem item) {
         items.add(item);
     }
 
@@ -47,7 +47,7 @@ public class ImageMetadata implements II
             prefix = "";
         }
 
-        StringBuilder result = new StringBuilder();
+        final StringBuilder result = new StringBuilder();
         for (int i = 0; i < items.size(); i++) {
             if (i > 0) {
                 result.append(newline);
@@ -55,7 +55,7 @@ public class ImageMetadata implements II
             // if (null != prefix)
             // result.append(prefix);
 
-            ImageMetadata.IImageMetadataItem item = items.get(i);
+            final ImageMetadata.IImageMetadataItem item = items.get(i);
             result.append(item.toString(prefix + "\t"));
 
             // Debug.debug("prefix", prefix);
@@ -68,7 +68,7 @@ public class ImageMetadata implements II
     public static class Item implements IImageMetadataItem {
         private final String keyword, text;
 
-        public Item(String keyword, String text) {
+        public Item(final String keyword, final String text) {
             this.keyword = keyword;
             this.text = text;
         }
@@ -86,7 +86,7 @@ public class ImageMetadata implements II
             return toString(null);
         }
 
-        public String toString(String prefix) {
+        public String toString(final String prefix) {
             String result = keyword + ": " + text;
             if (null != prefix) {
                 result = prefix + result;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/MyByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/MyByteArrayOutputStream.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/MyByteArrayOutputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/MyByteArrayOutputStream.java Tue Dec  4 17:23:16 2012
@@ -23,14 +23,14 @@ import java.io.OutputStream;
 public class MyByteArrayOutputStream extends OutputStream {
     private final byte bytes[];
 
-    public MyByteArrayOutputStream(int length) {
+    public MyByteArrayOutputStream(final int length) {
         bytes = new byte[length];
     }
 
     private int count = 0;
 
     @Override
-    public void write(int value) throws IOException {
+    public void write(final int value) throws IOException {
         if (count >= bytes.length) {
             throw new IOException("Write exceeded expected length (" + count
                     + ", " + bytes.length + ")");
@@ -42,7 +42,7 @@ public class MyByteArrayOutputStream ext
 
     public byte[] toByteArray() {
         if (count < bytes.length) {
-            byte result[] = new byte[count];
+            final byte result[] = new byte[count];
             System.arraycopy(bytes, 0, result, 0, count);
             return result;
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/PackBits.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/PackBits.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/PackBits.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/PackBits.java Tue Dec  4 17:23:16 2012
@@ -23,11 +23,11 @@ import org.apache.commons.imaging.ImageR
 
 public class PackBits {
 
-    public byte[] decompress(byte bytes[], int expected)
+    public byte[] decompress(final byte bytes[], final int expected)
             throws ImageReadException {
         int total = 0;
 
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
         // Loop until you get the number of unpacked bytes you are expecting:
         int i = 0;
@@ -40,11 +40,11 @@ public class PackBits {
                                 + expected);
             }
 
-            int n = bytes[i++];
+            final int n = bytes[i++];
             if ((n >= 0) && (n <= 127)) {
                 // If n is between 0 and 127 inclusive, copy the next n+1 bytes
                 // literally.
-                int count = n + 1;
+                final int count = n + 1;
 
                 total += count;
                 for (int j = 0; j < count; j++) {
@@ -54,8 +54,8 @@ public class PackBits {
                 // Else if n is between -127 and -1 inclusive, copy the next byte
                 // -n+1 times.
 
-                int b = bytes[i++];
-                int count = -n + 1;
+                final int b = bytes[i++];
+                final int count = -n + 1;
 
                 total += count;
                 for (int j = 0; j < count; j++) {
@@ -66,13 +66,13 @@ public class PackBits {
                 throw new ImageReadException("Packbits: " + n);
             }
         }
-        byte result[] = baos.toByteArray();
+        final byte result[] = baos.toByteArray();
 
         return result;
 
     }
 
-    private int findNextDuplicate(byte bytes[], int start) {
+    private int findNextDuplicate(final byte bytes[], final int start) {
         // int last = -1;
         if (start >= bytes.length) {
             return -1;
@@ -81,7 +81,7 @@ public class PackBits {
         byte prev = bytes[start];
 
         for (int i = start + 1; i < bytes.length; i++) {
-            byte b = bytes[i];
+            final byte b = bytes[i];
 
             if (b == prev) {
                 return i - 1;
@@ -93,8 +93,8 @@ public class PackBits {
         return -1;
     }
 
-    private int findRunLength(byte bytes[], int start) {
-        byte b = bytes[start];
+    private int findRunLength(final byte bytes[], final int start) {
+        final byte b = bytes[start];
 
         int i;
 
@@ -105,7 +105,7 @@ public class PackBits {
         return i - start;
     }
 
-    public byte[] compress(byte bytes[]) throws IOException {
+    public byte[] compress(final byte bytes[]) throws IOException {
         MyByteArrayOutputStream baos = null;
         try {
             baos = new MyByteArrayOutputStream(
@@ -117,8 +117,8 @@ public class PackBits {
     
                 if (dup == ptr) {
                     // write run length
-                    int len = findRunLength(bytes, dup);
-                    int actual_len = Math.min(len, 128);
+                    final int len = findRunLength(bytes, dup);
+                    final int actual_len = Math.min(len, 128);
                     baos.write(-(actual_len - 1));
                     baos.write(bytes[ptr]);
                     ptr += actual_len;
@@ -127,11 +127,11 @@ public class PackBits {
                     int len = dup - ptr;
     
                     if (dup > 0) {
-                        int runlen = findRunLength(bytes, dup);
+                        final int runlen = findRunLength(bytes, dup);
                         if (runlen < 3) {
                             // may want to discard next run.
-                            int nextptr = ptr + len + runlen;
-                            int nextdup = findNextDuplicate(bytes, nextptr);
+                            final int nextptr = ptr + len + runlen;
+                            final int nextdup = findNextDuplicate(bytes, nextptr);
                             if (nextdup != nextptr) {
                                 // discard 2-byte run
                                 dup = nextdup;
@@ -143,7 +143,7 @@ public class PackBits {
                     if (dup < 0) {
                         len = bytes.length - ptr;
                     }
-                    int actual_len = Math.min(len, 128);
+                    final int actual_len = Math.min(len, 128);
     
                     baos.write(actual_len - 1);
                     for (int i = 0; i < actual_len; i++) {
@@ -152,7 +152,7 @@ public class PackBits {
                     }
                 }
             }
-            byte result[] = baos.toByteArray();
+            final byte result[] = baos.toByteArray();
     
             return result;
         } finally {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java Tue Dec  4 17:23:16 2012
@@ -25,7 +25,7 @@ public class RationalNumber extends Numb
     public final int numerator;
     public final int divisor;
 
-    public RationalNumber(int numerator, int divisor) {
+    public RationalNumber(final int numerator, final int divisor) {
         this.numerator = numerator;
         this.divisor = divisor;
     }
@@ -51,7 +51,7 @@ public class RationalNumber extends Numb
             }
         }
 
-        long gcd = gcd(n, d);
+        final long gcd = gcd(n, d);
         d = d / gcd;
         n = n / gcd;
 
@@ -61,7 +61,7 @@ public class RationalNumber extends Numb
     /**
      * Return the greatest common divisor
      */
-    private static long gcd(long a, long b) {
+    private static long gcd(final long a, final long b) {
 
         if (b == 0) {
             return a;
@@ -116,7 +116,7 @@ public class RationalNumber extends Numb
         if ((numerator % divisor) == 0) {
             return "" + (numerator / divisor);
         }
-        NumberFormat nf = DecimalFormat.getInstance();
+        final NumberFormat nf = DecimalFormat.getInstance();
         nf.setMaximumFractionDigits(3);
         return nf.format((double) numerator / (double) divisor);
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumberUtilities.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumberUtilities.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumberUtilities.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumberUtilities.java Tue Dec  4 17:23:16 2012
@@ -67,7 +67,7 @@ public abstract class RationalNumberUtil
         if (value == 0) {
             return new RationalNumber(0, 1);
         } else if (value >= 1) {
-            int approx = (int) value;
+            final int approx = (int) value;
             if (approx < value) {
                 l = new RationalNumber(approx, 1);
                 h = new RationalNumber(approx + 1, 1);
@@ -76,7 +76,7 @@ public abstract class RationalNumberUtil
                 h = new RationalNumber(approx, 1);
             }
         } else {
-            int approx = (int) (1.0 / value);
+            final int approx = (int) (1.0 / value);
             if ((1.0 / approx) < value) {
                 l = new RationalNumber(1, approx);
                 h = new RationalNumber(1, approx - 1);
@@ -98,12 +98,12 @@ public abstract class RationalNumberUtil
             // + ", right: " + high + ", value: " + value + ", error: "
             // + bestOption.error);
 
-            RationalNumber mediant = RationalNumber.factoryMethod(
+            final RationalNumber mediant = RationalNumber.factoryMethod(
                     (long) low.rationalNumber.numerator
                             + (long) high.rationalNumber.numerator,
                     (long) low.rationalNumber.divisor
                             + (long) high.rationalNumber.divisor);
-            Option mediantOption = Option.factory(mediant, value);
+            final Option mediantOption = Option.factory(mediant, value);
 
             if (value < mediant.doubleValue()) {
                 if (high.error <= mediantOption.error) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RgbBufferedImageFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RgbBufferedImageFactory.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RgbBufferedImageFactory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RgbBufferedImageFactory.java Tue Dec  4 17:23:16 2012
@@ -20,16 +20,16 @@ package org.apache.commons.imaging.commo
 import java.awt.image.BufferedImage;
 
 public class RgbBufferedImageFactory implements IBufferedImageFactory {
-    public BufferedImage getColorBufferedImage(int width, int height,
-            boolean hasAlpha) {
+    public BufferedImage getColorBufferedImage(final int width, final int height,
+            final boolean hasAlpha) {
         if (hasAlpha) {
             return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
         }
         return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
     }
 
-    public BufferedImage getGrayscaleBufferedImage(int width, int height,
-            boolean hasAlpha) {
+    public BufferedImage getGrayscaleBufferedImage(final int width, final int height,
+            final boolean hasAlpha) {
         // always use color.
         return getColorBufferedImage(width, height, hasAlpha);
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/SimpleBufferedImageFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/SimpleBufferedImageFactory.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/SimpleBufferedImageFactory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/SimpleBufferedImageFactory.java Tue Dec  4 17:23:16 2012
@@ -20,16 +20,16 @@ package org.apache.commons.imaging.commo
 import java.awt.image.BufferedImage;
 
 public class SimpleBufferedImageFactory implements IBufferedImageFactory {
-    public BufferedImage getColorBufferedImage(int width, int height,
-            boolean hasAlpha) {
+    public BufferedImage getColorBufferedImage(final int width, final int height,
+            final boolean hasAlpha) {
         if (hasAlpha) {
             return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
         }
         return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
     }
 
-    public BufferedImage getGrayscaleBufferedImage(int width, int height,
-            boolean hasAlpha) {
+    public BufferedImage getGrayscaleBufferedImage(final int width, final int height,
+            final boolean hasAlpha) {
         if (hasAlpha) {
             return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ZLibUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ZLibUtils.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ZLibUtils.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ZLibUtils.java Tue Dec  4 17:23:16 2012
@@ -23,17 +23,17 @@ import java.util.zip.DeflaterOutputStrea
 import java.util.zip.InflaterInputStream;
 
 public class ZLibUtils extends BinaryFileFunctions {
-    public final byte[] inflate(byte bytes[]) throws IOException
+    public final byte[] inflate(final byte bytes[]) throws IOException
     // slow, probably.
     {
-        ByteArrayInputStream in = new ByteArrayInputStream(bytes);
-        InflaterInputStream zIn = new InflaterInputStream(in);
+        final ByteArrayInputStream in = new ByteArrayInputStream(bytes);
+        final InflaterInputStream zIn = new InflaterInputStream(in);
         return getStreamBytes(zIn);
     }
 
-    public final byte[] deflate(byte bytes[]) throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        DeflaterOutputStream dos = new DeflaterOutputStream(baos);
+    public final byte[] deflate(final byte bytes[]) throws IOException {
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final DeflaterOutputStream dos = new DeflaterOutputStream(baos);
         dos.write(bytes);
         dos.close();
         return baos.toByteArray();

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java Tue Dec  4 17:23:16 2012
@@ -28,7 +28,7 @@ public abstract class ByteSource extends
         this.filename = filename;
     }
 
-    public final InputStream getInputStream(int start) throws IOException {
+    public final InputStream getInputStream(final int start) throws IOException {
         InputStream is = null;
         boolean succeeded = false;
         try {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceArray.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceArray.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceArray.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceArray.java Tue Dec  4 17:23:16 2012
@@ -23,12 +23,12 @@ import java.io.InputStream;
 public class ByteSourceArray extends ByteSource {
     private final byte bytes[];
 
-    public ByteSourceArray(String filename, byte bytes[]) {
+    public ByteSourceArray(final String filename, final byte bytes[]) {
         super(filename);
         this.bytes = bytes;
     }
 
-    public ByteSourceArray(byte bytes[]) {
+    public ByteSourceArray(final byte bytes[]) {
         super(null);
         this.bytes = bytes;
     }
@@ -39,7 +39,7 @@ public class ByteSourceArray extends Byt
     }
 
     @Override
-    public byte[] getBlock(int start, int length) throws IOException {
+    public byte[] getBlock(final int start, final int length) throws IOException {
         // We include a separate check for int overflow.
         if ((start < 0) || (length < 0) || (start + length < 0)
                 || (start + length > bytes.length)) {
@@ -48,7 +48,7 @@ public class ByteSourceArray extends Byt
                     + bytes.length + ").");
         }
 
-        byte result[] = new byte[length];
+        final byte result[] = new byte[length];
         System.arraycopy(bytes, start, result, 0, length);
         return result;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java Tue Dec  4 17:23:16 2012
@@ -29,7 +29,7 @@ import org.apache.commons.imaging.util.D
 public class ByteSourceFile extends ByteSource {
     private final File file;
 
-    public ByteSourceFile(File file) {
+    public ByteSourceFile(final File file) {
         super(file.getName());
         this.file = file;
     }
@@ -44,7 +44,7 @@ public class ByteSourceFile extends Byte
     }
 
     @Override
-    public byte[] getBlock(int start, int length) throws IOException {
+    public byte[] getBlock(final int start, final int length) throws IOException {
 
         RandomAccessFile raf = null;
         try {
@@ -65,7 +65,7 @@ public class ByteSourceFile extends Byte
                 if (raf != null) {
                     raf.close();
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 Debug.debug(e);
             }
 
@@ -79,13 +79,13 @@ public class ByteSourceFile extends Byte
 
     @Override
     public byte[] getAll() throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
         InputStream is = null;
         try {
             is = new FileInputStream(file);
             is = new BufferedInputStream(is);
-            byte buffer[] = new byte[1024];
+            final byte buffer[] = new byte[1024];
             int read;
             while ((read = is.read(buffer)) > 0) {
                 baos.write(buffer, 0, read);
@@ -96,7 +96,7 @@ public class ByteSourceFile extends Byte
                 if (null != is) {
                     is.close();
                 }
-            } catch (IOException e) {
+            } catch (final IOException e) {
                 Debug.debug(e);
             }
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java Tue Dec  4 17:23:16 2012
@@ -26,7 +26,7 @@ public class ByteSourceInputStream exten
     private CacheBlock cacheHead = null;
     private static final int BLOCK_SIZE = 1024;
 
-    public ByteSourceInputStream(InputStream is, String filename) {
+    public ByteSourceInputStream(final InputStream is, final String filename) {
         super(filename);
         this.is = new BufferedInputStream(is);
     }
@@ -61,17 +61,17 @@ public class ByteSourceInputStream exten
             readBuffer = new byte[BLOCK_SIZE];
         }
 
-        int read = is.read(readBuffer);
+        final int read = is.read(readBuffer);
         if (read < 1) {
             return null;
         } else if (read < BLOCK_SIZE) {
             // return a copy.
-            byte result[] = new byte[read];
+            final byte result[] = new byte[read];
             System.arraycopy(readBuffer, 0, result, 0, read);
             return new CacheBlock(result);
         } else {
             // return current buffer.
-            byte result[] = readBuffer;
+            final byte result[] = readBuffer;
             readBuffer = null;
             return new CacheBlock(result);
         }
@@ -116,7 +116,7 @@ public class ByteSourceInputStream exten
         }
 
         @Override
-        public int read(byte b[], int off, int len) throws IOException {
+        public int read(final byte b[], final int off, final int len) throws IOException {
             // first section copied verbatim from InputStream
             if (b == null) {
                 throw new NullPointerException();
@@ -150,14 +150,14 @@ public class ByteSourceInputStream exten
                 return -1;
             }
 
-            int readSize = Math.min(len, block.bytes.length - blockIndex);
+            final int readSize = Math.min(len, block.bytes.length - blockIndex);
             System.arraycopy(block.bytes, blockIndex, b, off, readSize);
             blockIndex += readSize;
             return readSize;
         }
         
         @Override
-        public long skip(long n) throws IOException {
+        public long skip(final long n) throws IOException {
 
             long remaining = n;
 
@@ -189,7 +189,7 @@ public class ByteSourceInputStream exten
                     break;
                 }
 
-                int readSize = Math.min((int) Math.min(BLOCK_SIZE, remaining), block.bytes.length - blockIndex);
+                final int readSize = Math.min((int) Math.min(BLOCK_SIZE, remaining), block.bytes.length - blockIndex);
 
                 blockIndex += readSize;
                 remaining -= readSize;
@@ -206,7 +206,7 @@ public class ByteSourceInputStream exten
     }
 
     @Override
-    public byte[] getBlock(int blockStart, int blockLength) throws IOException {
+    public byte[] getBlock(final int blockStart, final int blockLength) throws IOException {
         // We include a separate check for int overflow.
         if ((blockStart < 0) || (blockLength < 0)
                 || (blockStart + blockLength < 0)
@@ -216,13 +216,13 @@ public class ByteSourceInputStream exten
                     + ", data length: " + streamLength + ").");
         }
 
-        InputStream is = getInputStream();
+        final InputStream is = getInputStream();
         skipBytes(is, blockStart);
 
-        byte bytes[] = new byte[blockLength];
+        final byte bytes[] = new byte[blockLength];
         int total = 0;
         while (true) {
-            int read = is.read(bytes, total, bytes.length - total);
+            final int read = is.read(bytes, total, bytes.length - total);
             if (read < 1) {
                 throw new IOException("Could not read block.");
             }
@@ -241,7 +241,7 @@ public class ByteSourceInputStream exten
             return streamLength;
         }
 
-        InputStream is = getInputStream();
+        final InputStream is = getInputStream();
         long result = 0;
         long skipped;
         while ((skipped = is.skip(1024)) > 0) {
@@ -253,7 +253,7 @@ public class ByteSourceInputStream exten
 
     @Override
     public byte[] getAll() throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
         CacheBlock block = getFirstBlock();
         while (block != null) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTree.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTree.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTree.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTree.java Tue Dec  4 17:23:16 2012
@@ -33,7 +33,7 @@ class HuffmanTree {
 
     private final List<Node> nodes = new ArrayList<Node>();
 
-    public final void insert(String pattern, Object value)
+    public final void insert(final String pattern, final Object value)
             throws HuffmanTreeException {
         int position = 0;
         Node node = growAndGetNode(position);
@@ -41,7 +41,7 @@ class HuffmanTree {
             throw new HuffmanTreeException("Can't add child to a leaf");
         }
         for (int patternPosition = 0; patternPosition < pattern.length(); patternPosition++) {
-            char nextChar = pattern.charAt(patternPosition);
+            final char nextChar = pattern.charAt(patternPosition);
             if (nextChar == '0') {
                 position = (position << 1) + 1;
             } else {
@@ -55,16 +55,16 @@ class HuffmanTree {
         node.value = value;
     }
 
-    private Node growAndGetNode(int position) {
+    private Node growAndGetNode(final int position) {
         while (position >= nodes.size()) {
             nodes.add(new Node());
         }
-        Node node = nodes.get(position);
+        final Node node = nodes.get(position);
         node.isEmpty = false;
         return node;
     }
 
-    public final Object decode(BitInputStreamFlexible bitStream)
+    public final Object decode(final BitInputStreamFlexible bitStream)
             throws HuffmanTreeException {
         int position = 0;
         Node node = nodes.get(0);
@@ -72,7 +72,7 @@ class HuffmanTree {
             int nextBit;
             try {
                 nextBit = bitStream.readBits(1);
-            } catch (IOException ioEx) {
+            } catch (final IOException ioEx) {
                 throw new HuffmanTreeException(
                         "Error reading stream for huffman tree", ioEx);
             }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTreeException.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTreeException.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTreeException.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTreeException.java Tue Dec  4 17:23:16 2012
@@ -19,11 +19,11 @@ package org.apache.commons.imaging.commo
 class HuffmanTreeException extends Exception {
     private static final long serialVersionUID = 1L;
 
-    public HuffmanTreeException(String message) {
+    public HuffmanTreeException(final String message) {
         super(message);
     }
 
-    public HuffmanTreeException(String message, Throwable throwable) {
+    public HuffmanTreeException(final String message, final Throwable throwable) {
         super(message, throwable);
     }
 }



Mime
View raw message