commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1417043 [7/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/formats/icns/IcnsType.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java Tue Dec  4 17:23:16 2012
@@ -93,8 +93,8 @@ public class IcnsType {
             ICNS_32x32_8BIT_MASK, ICNS_48x48_1BIT_IMAGE_AND_MASK,
             ICNS_48x48_8BIT_MASK, ICNS_128x128_8BIT_MASK };
 
-    private IcnsType(String type, int width, int height, int bitsPerPixel,
-            boolean hasMask) {
+    private IcnsType(final String type, final int width, final int height, final int bitsPerPixel,
+            final boolean hasMask) {
         this.type = typeAsInt(type);
         this.width = width;
         this.height = height;
@@ -129,13 +129,13 @@ public class IcnsType {
                 + hasMask + "]";
     }
 
-    public static IcnsType findAnyType(int type) {
-        for (IcnsType allImageType : allImageTypes) {
+    public static IcnsType findAnyType(final int type) {
+        for (final IcnsType allImageType : allImageTypes) {
             if (allImageType.getType() == type) {
                 return allImageType;
             }
         }
-        for (IcnsType allMaskType : allMaskTypes) {
+        for (final IcnsType allMaskType : allMaskTypes) {
             if (allMaskType.getType() == type) {
                 return allMaskType;
             }
@@ -143,8 +143,8 @@ public class IcnsType {
         return null;
     }
 
-    public static IcnsType findImageType(int type) {
-        for (IcnsType allImageType : allImageTypes) {
+    public static IcnsType findImageType(final int type) {
+        for (final IcnsType allImageType : allImageTypes) {
             if (allImageType.getType() == type) {
                 return allImageType;
             }
@@ -152,8 +152,8 @@ public class IcnsType {
         return null;
     }
 
-    public static IcnsType find8BPPMaskType(IcnsType imageType) {
-        for (IcnsType allMaskType : allMaskTypes) {
+    public static IcnsType find8BPPMaskType(final IcnsType imageType) {
+        for (final IcnsType allMaskType : allMaskTypes) {
             if (allMaskType.getBitsPerPixel() == 8
                     && allMaskType.getWidth() == imageType.getWidth()
                     && allMaskType.getHeight() == imageType.getHeight()) {
@@ -163,8 +163,8 @@ public class IcnsType {
         return null;
     }
 
-    public static IcnsType find1BPPMaskType(IcnsType imageType) {
-        for (IcnsType allMaskType : allMaskTypes) {
+    public static IcnsType find1BPPMaskType(final IcnsType imageType) {
+        for (final IcnsType allMaskType : allMaskTypes) {
             if (allMaskType.getBitsPerPixel() == 1
                     && allMaskType.getWidth() == imageType.getWidth()
                     && allMaskType.getHeight() == imageType.getHeight()) {
@@ -174,11 +174,11 @@ public class IcnsType {
         return null;
     }
 
-    public static int typeAsInt(String type) {
+    public static int typeAsInt(final String type) {
         byte[] bytes = null;
         try {
             bytes = type.getBytes("US-ASCII");
-        } catch (UnsupportedEncodingException cannotHappen) {
+        } catch (final UnsupportedEncodingException cannotHappen) {
             throw new IllegalArgumentException("Your Java doesn't support US-ASCII");
         }
         if (bytes.length != 4) {
@@ -188,15 +188,15 @@ public class IcnsType {
                 | ((0xff & bytes[2]) << 8) | (0xff & bytes[3]);
     }
 
-    public static String describeType(int type) {
-        byte[] bytes = new byte[4];
+    public static String describeType(final int type) {
+        final byte[] bytes = new byte[4];
         bytes[0] = (byte) (0xff & (type >> 24));
         bytes[1] = (byte) (0xff & (type >> 16));
         bytes[2] = (byte) (0xff & (type >> 8));
         bytes[3] = (byte) (0xff & type);
         try {
             return new String(bytes, "US-ASCII");
-        } catch (UnsupportedEncodingException cannotHappen) {
+        } catch (final UnsupportedEncodingException cannotHappen) {
         }
         return null;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/Rle24Compression.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/Rle24Compression.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/Rle24Compression.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/Rle24Compression.java Tue Dec  4 17:23:16 2012
@@ -17,7 +17,7 @@
 package org.apache.commons.imaging.formats.icns;
 
 class Rle24Compression {
-    public static byte[] decompress(int width, int height, byte[] data) {
+    public static byte[] decompress(final int width, final int height, final byte[] data) {
         final int pixelCount = width * height;
         final byte[] result = new byte[4 * pixelCount];
 
@@ -43,14 +43,14 @@ class Rle24Compression {
             int resultPos = 0;
             while (remaining > 0) {
                 if ((data[dataPos] & 0x80) != 0) {
-                    int count = (0xff & data[dataPos]) - 125;
+                    final int count = (0xff & data[dataPos]) - 125;
                     for (int i = 0; i < count; i++) {
                         result[band + 4 * (resultPos++)] = data[dataPos + 1];
                     }
                     dataPos += 2;
                     remaining -= count;
                 } else {
-                    int count = (0xff & data[dataPos]) + 1;
+                    final int count = (0xff & data[dataPos]) + 1;
                     dataPos++;
                     for (int i = 0; i < count; i++) {
                         result[band + 4 * (resultPos++)] = data[dataPos++];

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java Tue Dec  4 17:23:16 2012
@@ -78,30 +78,30 @@ public class IcoImageParser extends Imag
     }
 
     @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;
     }
 
     @Override
-    public ImageInfo getImageInfo(ByteSource byteSource, Map<String,Object> params)
+    public ImageInfo getImageInfo(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, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }
 
     @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;
     }
@@ -120,7 +120,7 @@ public class IcoImageParser extends Imag
             this.iconCount = iconCount;
         }
 
-        public void dump(PrintWriter pw) {
+        public void dump(final PrintWriter pw) {
             pw.println("FileHeader");
             pw.println("Reserved: " + reserved);
             pw.println("IconType: " + iconType);
@@ -129,11 +129,11 @@ public class IcoImageParser extends Imag
         }
     }
 
-    private FileHeader readFileHeader(InputStream is)
+    private FileHeader readFileHeader(final InputStream is)
             throws ImageReadException, IOException {
-        int Reserved = read2Bytes("Reserved", is, "Not a Valid ICO File");
-        int IconType = read2Bytes("IconType", is, "Not a Valid ICO File");
-        int IconCount = read2Bytes("IconCount", is, "Not a Valid ICO File");
+        final int Reserved = read2Bytes("Reserved", is, "Not a Valid ICO File");
+        final int IconType = read2Bytes("IconType", is, "Not a Valid ICO File");
+        final int IconCount = read2Bytes("IconCount", is, "Not a Valid ICO File");
 
         if (Reserved != 0) {
             throw new ImageReadException("Not a Valid ICO File: reserved is "
@@ -171,7 +171,7 @@ public class IcoImageParser extends Imag
             ImageOffset = imageOffset;
         }
 
-        public void dump(PrintWriter pw) {
+        public void dump(final PrintWriter pw) {
             pw.println("IconInfo");
             pw.println("Width: " + Width);
             pw.println("Height: " + Height);
@@ -184,28 +184,28 @@ public class IcoImageParser extends Imag
         }
     }
 
-    private IconInfo readIconInfo(InputStream is) throws ImageReadException,
+    private IconInfo readIconInfo(final InputStream is) throws ImageReadException,
             IOException {
         // Width (1 byte), Width of Icon (1 to 255)
-        byte Width = readByte("Width", is, "Not a Valid ICO File");
+        final byte Width = readByte("Width", is, "Not a Valid ICO File");
         // Height (1 byte), Height of Icon (1 to 255)
-        byte Height = readByte("Height", is, "Not a Valid ICO File");
+        final byte Height = readByte("Height", is, "Not a Valid ICO File");
         // ColorCount (1 byte), Number of colors, either
         // 0 for 24 bit or higher,
         // 2 for monochrome or 16 for 16 color images.
-        byte ColorCount = readByte("ColorCount", is, "Not a Valid ICO File");
+        final byte ColorCount = readByte("ColorCount", is, "Not a Valid ICO File");
         // Reserved (1 byte), Not used (always 0)
-        byte Reserved = readByte("Reserved", is, "Not a Valid ICO File");
+        final byte Reserved = readByte("Reserved", is, "Not a Valid ICO File");
         // Planes (2 bytes), always 1
-        int Planes = read2Bytes("Planes", is, "Not a Valid ICO File");
+        final int Planes = read2Bytes("Planes", is, "Not a Valid ICO File");
         // BitCount (2 bytes), number of bits per pixel (1 for monchrome,
         // 4 for 16 colors, 8 for 256 colors, 24 for true colors,
         // 32 for true colors + alpha channel)
-        int BitCount = read2Bytes("BitCount", is, "Not a Valid ICO File");
+        final int BitCount = read2Bytes("BitCount", is, "Not a Valid ICO File");
         // ImageSize (4 bytes), Length of resource in bytes
-        int ImageSize = read4Bytes("ImageSize", is, "Not a Valid ICO File");
+        final int ImageSize = read4Bytes("ImageSize", is, "Not a Valid ICO File");
         // ImageOffset (4 bytes), start of the image in the file
-        int ImageOffset = read4Bytes("ImageOffset", is, "Not a Valid ICO File");
+        final int ImageOffset = read4Bytes("ImageOffset", is, "Not a Valid ICO File");
 
         return new IconInfo(Width, Height, ColorCount, Reserved, Planes,
                 BitCount, ImageSize, ImageOffset);
@@ -242,7 +242,7 @@ public class IcoImageParser extends Imag
             ColorsImportant = colorsImportant;
         }
 
-        public void dump(PrintWriter pw) {
+        public void dump(final PrintWriter pw) {
             pw.println("BitmapHeader");
 
             pw.println("Size: " + Size);
@@ -266,7 +266,7 @@ public class IcoImageParser extends Imag
             this.iconInfo = iconInfo;
         }
 
-        public void dump(PrintWriter pw) {
+        public void dump(final PrintWriter pw) {
             iconInfo.dump(pw);
             pw.println();
             dumpSubclass(pw);
@@ -295,7 +295,7 @@ public class IcoImageParser extends Imag
         }
 
         @Override
-        protected void dumpSubclass(PrintWriter pw) {
+        protected void dumpSubclass(final PrintWriter pw) {
             pw.println("BitmapIconData");
             header.dump(pw);
             pw.println();
@@ -317,30 +317,30 @@ public class IcoImageParser extends Imag
         }
 
         @Override
-        protected void dumpSubclass(PrintWriter pw) {
+        protected void dumpSubclass(final PrintWriter pw) {
             pw.println("PNGIconData");
             pw.println();
         }
     }
 
-    private IconData readBitmapIconData(byte[] iconData, IconInfo fIconInfo)
+    private IconData readBitmapIconData(final byte[] iconData, final IconInfo fIconInfo)
             throws ImageReadException, IOException {
-        ByteArrayInputStream is = new ByteArrayInputStream(iconData);
-        int Size = read4Bytes("Size", is, "Not a Valid ICO File"); // Size (4
+        final ByteArrayInputStream is = new ByteArrayInputStream(iconData);
+        final int Size = read4Bytes("Size", is, "Not a Valid ICO File"); // Size (4
                                                                    // bytes),
                                                                    // size of
                                                                    // this
                                                                    // structure
                                                                    // (always
                                                                    // 40)
-        int Width = read4Bytes("Width", is, "Not a Valid ICO File"); // Width (4
+        final int Width = read4Bytes("Width", is, "Not a Valid ICO File"); // Width (4
                                                                      // bytes),
                                                                      // width of
                                                                      // the
                                                                      // image
                                                                      // (same as
                                                                      // iconinfo.width)
-        int Height = read4Bytes("Height", is, "Not a Valid ICO File"); // Height
+        final int Height = read4Bytes("Height", is, "Not a Valid ICO File"); // Height
                                                                        // (4
                                                                        // bytes),
                                                                        // scanlines
@@ -351,12 +351,12 @@ public class IcoImageParser extends Imag
                                                                        // map
                                                                        // (iconinfo.height
                                                                        // * 2)
-        int Planes = read2Bytes("Planes", is, "Not a Valid ICO File"); // Planes
+        final int Planes = read2Bytes("Planes", is, "Not a Valid ICO File"); // Planes
                                                                        // (2
                                                                        // bytes),
                                                                        // always
                                                                        // 1
-        int BitCount = read2Bytes("BitCount", is, "Not a Valid ICO File"); // BitCount
+        final int BitCount = read2Bytes("BitCount", is, "Not a Valid ICO File"); // BitCount
                                                                            // (2
                                                                            // bytes),
                                                                            // 1,4,8,16,24,32
@@ -372,7 +372,7 @@ public class IcoImageParser extends Imag
                                                                                  // use
                                                                                  // this
                                                                                  // (0)
-        int SizeImage = read4Bytes("SizeImage", is, "Not a Valid ICO File"); // SizeImage
+        final int SizeImage = read4Bytes("SizeImage", is, "Not a Valid ICO File"); // SizeImage
                                                                              // (4
                                                                              // bytes),
                                                                              // we
@@ -380,13 +380,13 @@ public class IcoImageParser extends Imag
                                                                              // use
                                                                              // this
                                                                              // (0)
-        int XPelsPerMeter = read4Bytes("XPelsPerMeter", is,
+        final int XPelsPerMeter = read4Bytes("XPelsPerMeter", is,
                 "Not a Valid ICO File"); // XPelsPerMeter (4 bytes), we don?t
                                          // use this (0)
-        int YPelsPerMeter = read4Bytes("YPelsPerMeter", is,
+        final int YPelsPerMeter = read4Bytes("YPelsPerMeter", is,
                 "Not a Valid ICO File"); // YPelsPerMeter (4 bytes), we don?t
                                          // use this (0)
-        int ColorsUsed = read4Bytes("ColorsUsed", is, "Not a Valid ICO File"); // ColorsUsed
+        final int ColorsUsed = read4Bytes("ColorsUsed", is, "Not a Valid ICO File"); // ColorsUsed
                                                                                // (4
                                                                                // bytes),
                                                                                // we
@@ -394,7 +394,7 @@ public class IcoImageParser extends Imag
                                                                                // use
                                                                                // this
                                                                                // (0)
-        int ColorsImportant = read4Bytes("ColorsImportant", is,
+        final int ColorsImportant = read4Bytes("ColorsImportant", is,
                 "Not a Valid ICO File"); // ColorsImportant (4 bytes), we don?t
                                          // use this (0)
         int RedMask = 0;
@@ -406,7 +406,7 @@ public class IcoImageParser extends Imag
             GreenMask = read4Bytes("GreenMask", is, "Not a Valid ICO File");
             BlueMask = read4Bytes("BlueMask", is, "Not a Valid ICO File");
         }
-        byte[] RestOfFile = readByteArray("RestOfFile", is.available(), is);
+        final byte[] RestOfFile = readByteArray("RestOfFile", is.available(), is);
 
         if (Size != 40) {
             throw new ImageReadException(
@@ -427,16 +427,16 @@ public class IcoImageParser extends Imag
             AlphaMask = 0xff000000;
         }
 
-        BitmapHeader header = new BitmapHeader(Size, Width, Height, Planes,
+        final BitmapHeader header = new BitmapHeader(Size, Width, Height, Planes,
                 BitCount, Compression, SizeImage, XPelsPerMeter, YPelsPerMeter,
                 ColorsUsed, ColorsImportant);
 
-        int bitmapPixelsOffset = 14 + 56 + 4 * ((ColorsUsed == 0 && BitCount <= 8) ? (1 << BitCount)
+        final int bitmapPixelsOffset = 14 + 56 + 4 * ((ColorsUsed == 0 && BitCount <= 8) ? (1 << BitCount)
                 : ColorsUsed);
-        int bitmapSize = 14 + 56 + RestOfFile.length;
+        final int bitmapSize = 14 + 56 + RestOfFile.length;
 
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(bitmapSize);
-        BinaryOutputStream bos = new BinaryOutputStream(baos,
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream(bitmapSize);
+        final BinaryOutputStream bos = new BinaryOutputStream(baos,
                 ByteOrder.LITTLE_ENDIAN);
 
         bos.write('B');
@@ -463,9 +463,9 @@ public class IcoImageParser extends Imag
         bos.write(RestOfFile);
         bos.flush();
 
-        ByteArrayInputStream bmpInputStream = new ByteArrayInputStream(
+        final ByteArrayInputStream bmpInputStream = new ByteArrayInputStream(
                 baos.toByteArray());
-        BufferedImage bmpImage = new BmpImageParser().getBufferedImage(
+        final BufferedImage bmpImage = new BmpImageParser().getBufferedImage(
                 bmpInputStream, null);
 
         // Transparency map is optional with 32 BPP icons, because they already
@@ -480,13 +480,13 @@ public class IcoImageParser extends Imag
             t_scanline_size += 4 - (t_scanline_size % 4); // pad scanline to 4
                                                           // byte size.
         }
-        int tcolor_map_size_bytes = t_scanline_size * (Height / 2);
+        final int tcolor_map_size_bytes = t_scanline_size * (Height / 2);
         byte[] transparency_map = null;
         try {
             transparency_map = this.readByteArray("transparency_map",
                     tcolor_map_size_bytes, bmpInputStream,
                     "Not a Valid ICO File");
-        } catch (IOException ioEx) {
+        } catch (final IOException ioEx) {
             if (BitCount != 32) {
                 throw ioEx;
             }
@@ -511,7 +511,7 @@ public class IcoImageParser extends Imag
                 for (int x = 0; x < resultImage.getWidth(); x++) {
                     int alpha = 0xff;
                     if (transparency_map != null) {
-                        int alpha_byte = 0xff & transparency_map[t_scanline_size
+                        final int alpha_byte = 0xff & transparency_map[t_scanline_size
                                 * (bmpImage.getHeight() - y - 1) + (x / 8)];
                         alpha = 0x01 & (alpha_byte >> (7 - (x % 8)));
                         alpha = (alpha == 0) ? 0xff : 0x00;
@@ -526,12 +526,12 @@ public class IcoImageParser extends Imag
         return new BitmapIconData(fIconInfo, header, resultImage);
     }
 
-    private IconData readIconData(byte[] iconData, IconInfo fIconInfo)
+    private IconData readIconData(final byte[] iconData, final IconInfo fIconInfo)
             throws ImageReadException, IOException {
-        ImageFormat imageFormat = Imaging.guessFormat(iconData);
+        final ImageFormat imageFormat = Imaging.guessFormat(iconData);
         if (imageFormat.equals(ImageFormat.IMAGE_FORMAT_PNG)) {
-            BufferedImage bufferedImage = Imaging.getBufferedImage(iconData);
-            PNGIconData pngIconData = new PNGIconData(fIconInfo, bufferedImage);
+            final BufferedImage bufferedImage = Imaging.getBufferedImage(iconData);
+            final PNGIconData pngIconData = new PNGIconData(fIconInfo, bufferedImage);
             return pngIconData;
         } else {
             return readBitmapIconData(iconData, fIconInfo);
@@ -550,21 +550,21 @@ public class IcoImageParser extends Imag
         }
     }
 
-    private ImageContents readImage(ByteSource byteSource)
+    private ImageContents readImage(final ByteSource byteSource)
             throws ImageReadException, IOException {
         InputStream is = null;
         try {
             is = byteSource.getInputStream();
-            FileHeader fileHeader = readFileHeader(is);
+            final FileHeader fileHeader = readFileHeader(is);
 
-            IconInfo fIconInfos[] = new IconInfo[fileHeader.iconCount];
+            final IconInfo fIconInfos[] = new IconInfo[fileHeader.iconCount];
             for (int i = 0; i < fileHeader.iconCount; i++) {
                 fIconInfos[i] = readIconInfo(is);
             }
 
-            IconData fIconDatas[] = new IconData[fileHeader.iconCount];
+            final IconData fIconDatas[] = new IconData[fileHeader.iconCount];
             for (int i = 0; i < fileHeader.iconCount; i++) {
-                byte[] iconData = byteSource.getBlock(
+                final byte[] iconData = byteSource.getBlock(
                         fIconInfos[i].ImageOffset, fIconInfos[i].ImageSize);
                 fIconDatas[i] = readIconData(iconData, fIconInfos[i]);
             }
@@ -575,7 +575,7 @@ public class IcoImageParser extends Imag
                 if (is != null) {
                     is.close();
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 Debug.debug(e);
             }
 
@@ -583,21 +583,21 @@ public class IcoImageParser extends Imag
     }
 
     @Override
-    public boolean dumpImageFile(PrintWriter pw, ByteSource byteSource)
+    public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource)
             throws ImageReadException, IOException {
-        ImageContents contents = readImage(byteSource);
+        final ImageContents contents = readImage(byteSource);
         contents.fileHeader.dump(pw);
-        for (IconData iconData : contents.iconDatas) {
+        for (final IconData iconData : contents.iconDatas) {
             iconData.dump(pw);
         }
         return true;
     }
 
     @Override
-    public final BufferedImage getBufferedImage(ByteSource byteSource,
-            Map<String,Object> params) throws ImageReadException, IOException {
-        ImageContents contents = readImage(byteSource);
-        FileHeader fileHeader = contents.fileHeader;
+    public final BufferedImage getBufferedImage(final ByteSource byteSource,
+            final Map<String,Object> params) throws ImageReadException, IOException {
+        final ImageContents contents = readImage(byteSource);
+        final FileHeader fileHeader = contents.fileHeader;
         if (fileHeader.iconCount > 0) {
             return contents.iconDatas[0].readBufferedImage();
         } else {
@@ -606,16 +606,16 @@ public class IcoImageParser extends Imag
     }
 
     @Override
-    public List<BufferedImage> getAllBufferedImages(ByteSource byteSource)
+    public List<BufferedImage> getAllBufferedImages(final ByteSource byteSource)
             throws ImageReadException, IOException {
-        List<BufferedImage> result = new ArrayList<BufferedImage>();
-        ImageContents contents = readImage(byteSource);
+        final List<BufferedImage> result = new ArrayList<BufferedImage>();
+        final ImageContents contents = readImage(byteSource);
 
-        FileHeader fileHeader = contents.fileHeader;
+        final FileHeader fileHeader = contents.fileHeader;
         for (int i = 0; i < fileHeader.iconCount; i++) {
-            IconData iconData = contents.iconDatas[i];
+            final IconData iconData = contents.iconDatas[i];
 
-            BufferedImage image = iconData.readBufferedImage();
+            final BufferedImage image = iconData.readBufferedImage();
 
             result.add(image);
         }
@@ -648,7 +648,7 @@ public class IcoImageParser extends Imag
     // }
 
     @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);
@@ -658,10 +658,10 @@ public class IcoImageParser extends Imag
             params.remove(PARAM_KEY_FORMAT);
         }
         
-        PixelDensity pixelDensity = (PixelDensity) params.remove(PARAM_KEY_PIXEL_DENSITY);
+        final PixelDensity pixelDensity = (PixelDensity) params.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);
         }
 
@@ -684,7 +684,7 @@ public class IcoImageParser extends Imag
             bitCount = 8;
         }
 
-        BinaryOutputStream bos = new BinaryOutputStream(os, ByteOrder.INTEL);
+        final BinaryOutputStream bos = new BinaryOutputStream(os, ByteOrder.INTEL);
 
         int scanline_size = (bitCount * src.getWidth() + 7) / 8;
         if ((scanline_size % 4) != 0) {
@@ -696,7 +696,7 @@ public class IcoImageParser extends Imag
             t_scanline_size += 4 - (t_scanline_size % 4); // pad scanline to 4
                                                           // byte size.
         }
-        int imageSize = 40 + 4 * (bitCount <= 8 ? (1 << bitCount) : 0)
+        final int imageSize = 40 + 4 * (bitCount <= 8 ? (1 << bitCount) : 0)
                 + src.getHeight() * scanline_size + src.getHeight()
                 * t_scanline_size;
 
@@ -737,7 +737,7 @@ public class IcoImageParser extends Imag
         if (palette != null) {
             for (int i = 0; i < (1 << bitCount); i++) {
                 if (i < palette.length()) {
-                    int argb = palette.getEntry(i);
+                    final int argb = palette.getEntry(i);
                     bos.write(0xff & argb);
                     bos.write(0xff & (argb >> 8));
                     bos.write(0xff & (argb >> 16));
@@ -753,13 +753,13 @@ public class IcoImageParser extends Imag
 
         int bit_cache = 0;
         int bits_in_cache = 0;
-        int row_padding = scanline_size - (bitCount * src.getWidth() + 7) / 8;
+        final int row_padding = scanline_size - (bitCount * src.getWidth() + 7) / 8;
         for (int y = src.getHeight() - 1; y >= 0; y--) {
             for (int x = 0; x < src.getWidth(); x++) {
-                int argb = src.getRGB(x, y);
+                final int argb = src.getRGB(x, y);
                 if (bitCount < 8) {
-                    int rgb = 0xffffff & argb;
-                    int index = palette.getPaletteIndex(rgb);
+                    final int rgb = 0xffffff & argb;
+                    final int index = palette.getPaletteIndex(rgb);
                     bit_cache <<= bitCount;
                     bit_cache |= index;
                     bits_in_cache += bitCount;
@@ -769,8 +769,8 @@ public class IcoImageParser extends Imag
                         bits_in_cache = 0;
                     }
                 } else if (bitCount == 8) {
-                    int rgb = 0xffffff & argb;
-                    int index = palette.getPaletteIndex(rgb);
+                    final int rgb = 0xffffff & argb;
+                    final int index = palette.getPaletteIndex(rgb);
                     bos.write(0xff & index);
                 } else if (bitCount == 24) {
                     bos.write(0xff & argb);
@@ -796,11 +796,11 @@ public class IcoImageParser extends Imag
             }
         }
 
-        int t_row_padding = t_scanline_size - (src.getWidth() + 7) / 8;
+        final int t_row_padding = t_scanline_size - (src.getWidth() + 7) / 8;
         for (int y = src.getHeight() - 1; y >= 0; y--) {
             for (int x = 0; x < src.getWidth(); x++) {
-                int argb = src.getRGB(x, y);
-                int alpha = 0xff & (argb >> 24);
+                final int argb = src.getRGB(x, y);
+                final int alpha = 0xff & (argb >> 24);
                 bit_cache <<= 1;
                 if (alpha == 0) {
                     bit_cache |= 1;
@@ -837,7 +837,7 @@ public class IcoImageParser 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/jpeg/Block.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/Block.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/Block.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/Block.java Tue Dec  4 17:23:16 2012
@@ -20,7 +20,7 @@ public final class Block {
     public final int width;
     public final int height;
 
-    public Block(int width, int height) {
+    public Block(final int width, final int height) {
         samples = new int[width * height];
         this.width = width;
         this.height = height;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java Tue Dec  4 17:23:16 2012
@@ -53,26 +53,26 @@ public class JpegImageMetadata implement
         return photoshop;
     }
 
-    public TiffField findEXIFValue(TagInfo tagInfo) {
+    public TiffField findEXIFValue(final TagInfo tagInfo) {
         try {
             if (exif != null) {
                 return exif.findField(tagInfo);
             } else {
                 return null;
             }
-        } catch (ImageReadException cannotHappen) {
+        } catch (final ImageReadException cannotHappen) {
             return null;
         }
     }
 
-    public TiffField findEXIFValueWithExactMatch(TagInfo tagInfo) {
+    public TiffField findEXIFValueWithExactMatch(final TagInfo tagInfo) {
         try {
             if (exif != null) {
                 return exif.findField(tagInfo, true);
             } else {
                 return null;
             }
-        } catch (ImageReadException cannotHappen) {
+        } catch (final ImageReadException cannotHappen) {
             return null;
         }
     }
@@ -86,7 +86,7 @@ public class JpegImageMetadata implement
      */
     public Dimension getEXIFThumbnailSize() throws ImageReadException,
             IOException {
-        byte[] data = getEXIFThumbnailData();
+        final byte[] data = getEXIFThumbnailData();
 
         if (data != null) {
             return Imaging.getImageSize(data);
@@ -105,9 +105,9 @@ public class JpegImageMetadata implement
         if (exif == null) {
             return null;
         }
-        List<? extends IImageMetadataItem> dirs = exif.getDirectories();
+        final List<? extends IImageMetadataItem> dirs = exif.getDirectories();
         for (int i = 0; i < dirs.size(); i++) {
-            TiffImageMetadata.Directory dir = (TiffImageMetadata.Directory) dirs
+            final TiffImageMetadata.Directory dir = (TiffImageMetadata.Directory) dirs
                     .get(i);
 
             byte[] data = null;
@@ -138,9 +138,9 @@ public class JpegImageMetadata implement
             return null;
         }
 
-        List<? extends IImageMetadataItem> dirs = exif.getDirectories();
+        final List<? extends IImageMetadataItem> dirs = exif.getDirectories();
         for (int i = 0; i < dirs.size(); i++) {
-            TiffImageMetadata.Directory dir = (TiffImageMetadata.Directory) dirs
+            final TiffImageMetadata.Directory dir = (TiffImageMetadata.Directory) dirs
                     .get(i);
             // Debug.debug("dir", dir);
             BufferedImage image = dir.getThumbnail();
@@ -148,9 +148,9 @@ public class JpegImageMetadata implement
                 return image;
             }
 
-            JpegImageData jpegImageData = dir.getJpegImageData();
+            final JpegImageData jpegImageData = dir.getJpegImageData();
             if (jpegImageData != null) {
-                ByteArrayInputStream input = new ByteArrayInputStream(
+                final ByteArrayInputStream input = new ByteArrayInputStream(
                         jpegImageData.data);
                 // JPEG thumbnail as JPEG or other format; try to parse.
                 image = ImageIO.read(input);
@@ -167,12 +167,12 @@ public class JpegImageMetadata implement
         if (exif == null) {
             return null;
         }
-        List<? extends IImageMetadataItem> dirs = exif.getDirectories();
+        final List<? extends IImageMetadataItem> dirs = exif.getDirectories();
         for (int i = 0; i < dirs.size(); i++) {
-            TiffImageMetadata.Directory dir = (TiffImageMetadata.Directory) dirs
+            final TiffImageMetadata.Directory dir = (TiffImageMetadata.Directory) dirs
                     .get(i);
             // Debug.debug("dir", dir);
-            TiffImageData rawImageData = dir.getTiffImageData();
+            final TiffImageData rawImageData = dir.getTiffImageData();
             if (null != rawImageData) {
                 return rawImageData;
             }
@@ -182,7 +182,7 @@ public class JpegImageMetadata implement
     }
 
     public List<IImageMetadataItem> getItems() {
-        List<IImageMetadataItem> result = new ArrayList<IImageMetadataItem>();
+        final List<IImageMetadataItem> result = new ArrayList<IImageMetadataItem>();
 
         if (null != exif) {
             result.addAll(exif.getItems());
@@ -207,7 +207,7 @@ public class JpegImageMetadata implement
             prefix = "";
         }
 
-        StringBuilder result = new StringBuilder();
+        final StringBuilder result = new StringBuilder();
 
         result.append(prefix);
         if (null == exif) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java Tue Dec  4 17:23:16 2012
@@ -89,18 +89,18 @@ public class JpegImageParser extends Ima
     }
 
     @Override
-    public final BufferedImage getBufferedImage(ByteSource byteSource,
-            Map<String,Object> params) throws ImageReadException, IOException {
-        JpegDecoder jpegDecoder = new JpegDecoder();
+    public final BufferedImage getBufferedImage(final ByteSource byteSource,
+            final Map<String,Object> params) throws ImageReadException, IOException {
+        final JpegDecoder jpegDecoder = new JpegDecoder();
         return jpegDecoder.decode(byteSource);
     }
 
-    private boolean keepMarker(int marker, int markers[]) {
+    private boolean keepMarker(final int marker, final int markers[]) {
         if (markers == null) {
             return true;
         }
 
-        for (int marker2 : markers) {
+        for (final int marker2 : markers) {
             if (marker2 == marker) {
                 return true;
             }
@@ -109,9 +109,9 @@ public class JpegImageParser extends Ima
         return false;
     }
 
-    public List<Segment> readSegments(ByteSource byteSource,
+    public List<Segment> readSegments(final ByteSource byteSource,
             final int markers[], final boolean returnAfterFirst,
-            boolean readEverything) throws ImageReadException, IOException {
+            final boolean readEverything) throws ImageReadException, IOException {
         final List<Segment> result = new ArrayList<Segment>();
         final JpegImageParser parser = this;
         final int[] sofnSegments = {
@@ -122,20 +122,20 @@ public class JpegImageParser extends Ima
                 SOF7Marker, SOF9Marker, SOF10Marker, SOF11Marker, SOF13Marker,
                 SOF14Marker, SOF15Marker, };
 
-        JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
+        final JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
             // return false to exit before reading image data.
             public boolean beginSOS() {
                 return false;
             }
 
-            public void visitSOS(int marker, byte markerBytes[],
-                    byte imageData[]) {
+            public void visitSOS(final int marker, final byte markerBytes[],
+                    final byte imageData[]) {
             }
 
             // return false to exit traversal.
-            public boolean visitSegment(int marker, byte markerBytes[],
-                    int markerLength, byte markerLengthBytes[],
-                    byte segmentData[]) throws ImageReadException, IOException {
+            public boolean visitSegment(final int marker, final byte markerBytes[],
+                    final int markerLength, final byte markerLengthBytes[],
+                    final byte segmentData[]) throws ImageReadException, IOException {
                 if (marker == EOIMarker) {
                     return false;
                 }
@@ -185,22 +185,22 @@ public class JpegImageParser extends Ima
 
     public static final boolean permissive = true;
 
-    private byte[] assembleSegments(List<App2Segment> v)
+    private byte[] assembleSegments(final List<App2Segment> v)
             throws ImageReadException {
         try {
             return assembleSegments(v, false);
-        } catch (ImageReadException e) {
+        } catch (final ImageReadException e) {
             return assembleSegments(v, true);
         }
     }
 
-    private byte[] assembleSegments(List<App2Segment> v, boolean start_with_zero)
+    private byte[] assembleSegments(final List<App2Segment> v, final boolean start_with_zero)
             throws ImageReadException {
         if (v.size() < 1) {
             throw new ImageReadException("No App2 Segments Found.");
         }
 
-        int markerCount = v.get(0).num_markers;
+        final int markerCount = v.get(0).num_markers;
 
         // if (permissive && (markerCount == 0))
         // markerCount = v.size();
@@ -212,11 +212,11 @@ public class JpegImageParser extends Ima
 
         Collections.sort(v);
 
-        int offset = start_with_zero ? 0 : 1;
+        final int offset = start_with_zero ? 0 : 1;
 
         int total = 0;
         for (int i = 0; i < v.size(); i++) {
-            App2Segment segment = v.get(i);
+            final App2Segment segment = v.get(i);
 
             if ((i + offset) != segment.cur_marker) {
                 dumpSegments(v);
@@ -237,11 +237,11 @@ public class JpegImageParser extends Ima
             total += segment.icc_bytes.length;
         }
 
-        byte result[] = new byte[total];
+        final byte result[] = new byte[total];
         int progress = 0;
 
         for (int i = 0; i < v.size(); i++) {
-            App2Segment segment = v.get(i);
+            final App2Segment segment = v.get(i);
 
             System.arraycopy(segment.icc_bytes, 0, result, progress,
                     segment.icc_bytes.length);
@@ -251,12 +251,12 @@ public class JpegImageParser extends Ima
         return result;
     }
 
-    private void dumpSegments(List<? extends Segment> v) {
+    private void dumpSegments(final List<? extends Segment> v) {
         Debug.debug();
         Debug.debug("dumpSegments", v.size());
 
         for (int i = 0; i < v.size(); i++) {
-            App2Segment segment = (App2Segment) v.get(i);
+            final App2Segment segment = (App2Segment) v.get(i);
 
             Debug.debug((i) + ": " + segment.cur_marker + " / "
                     + segment.num_markers);
@@ -264,22 +264,22 @@ public class JpegImageParser extends Ima
         Debug.debug();
     }
 
-    public List<Segment> readSegments(ByteSource byteSource, int markers[],
-            boolean returnAfterFirst) throws ImageReadException, IOException {
+    public List<Segment> readSegments(final ByteSource byteSource, final int markers[],
+            final boolean returnAfterFirst) throws ImageReadException, IOException {
         return readSegments(byteSource, markers, returnAfterFirst, false);
     }
 
     @Override
-    public byte[] getICCProfileBytes(ByteSource byteSource, Map<String,Object> params)
+    public byte[] getICCProfileBytes(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
-        List<Segment> segments = readSegments(byteSource,
+        final List<Segment> segments = readSegments(byteSource,
                 new int[] { JPEG_APP2_Marker, }, false);
 
-        List<App2Segment> filtered = new ArrayList<App2Segment>();
+        final List<App2Segment> filtered = new ArrayList<App2Segment>();
         if (segments != null) {
             // throw away non-icc profile app2 segments.
             for (int i = 0; i < segments.size(); i++) {
-                App2Segment segment = (App2Segment) segments.get(i);
+                final App2Segment segment = (App2Segment) segments.get(i);
                 if (segment.icc_bytes != null) {
                     filtered.add(segment);
                 }
@@ -290,7 +290,7 @@ public class JpegImageParser extends Ima
             return null;
         }
 
-        byte bytes[] = assembleSegments(filtered);
+        final byte bytes[] = assembleSegments(filtered);
 
         if (debug) {
             System.out.println("bytes" + ": " + bytes.length);
@@ -304,31 +304,31 @@ public class JpegImageParser extends Ima
     }
 
     @Override
-    public IImageMetadata getMetadata(ByteSource byteSource, Map<String,Object> params)
+    public IImageMetadata getMetadata(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
-        TiffImageMetadata exif = getExifMetadata(byteSource, params);
+        final TiffImageMetadata exif = getExifMetadata(byteSource, params);
 
-        JpegPhotoshopMetadata photoshop = getPhotoshopMetadata(byteSource,
+        final JpegPhotoshopMetadata photoshop = getPhotoshopMetadata(byteSource,
                 params);
 
         if (null == exif && null == photoshop) {
             return null;
         }
 
-        JpegImageMetadata result = new JpegImageMetadata(photoshop, exif);
+        final JpegImageMetadata result = new JpegImageMetadata(photoshop, exif);
 
         return result;
     }
 
-    public static boolean isExifAPP1Segment(GenericSegment segment) {
+    public static boolean isExifAPP1Segment(final GenericSegment segment) {
         return byteArrayHasPrefix(segment.bytes, EXIF_IDENTIFIER_CODE);
     }
 
-    private List<Segment> filterAPP1Segments(List<Segment> v) {
-        List<Segment> result = new ArrayList<Segment>();
+    private List<Segment> filterAPP1Segments(final List<Segment> v) {
+        final List<Segment> result = new ArrayList<Segment>();
 
         for (int i = 0; i < v.size(); i++) {
-            GenericSegment segment = (GenericSegment) v.get(i);
+            final GenericSegment segment = (GenericSegment) v.get(i);
             if (isExifAPP1Segment(segment)) {
                 result.add(segment);
             }
@@ -337,9 +337,9 @@ public class JpegImageParser extends Ima
         return result;
     }
 
-    public TiffImageMetadata getExifMetadata(ByteSource byteSource, Map<String,Object> params)
+    public TiffImageMetadata getExifMetadata(final ByteSource byteSource, Map<String,Object> params)
             throws ImageReadException, IOException {
-        byte bytes[] = getExifRawData(byteSource);
+        final byte bytes[] = getExifRawData(byteSource);
         if (null == bytes) {
             return null;
         }
@@ -355,16 +355,16 @@ public class JpegImageParser extends Ima
                 params);
     }
 
-    public byte[] getExifRawData(ByteSource byteSource)
+    public byte[] getExifRawData(final ByteSource byteSource)
             throws ImageReadException, IOException {
-        List<Segment> segments = readSegments(byteSource,
+        final List<Segment> segments = readSegments(byteSource,
                 new int[] { JPEG_APP1_Marker, }, false);
 
         if ((segments == null) || (segments.size() < 1)) {
             return null;
         }
 
-        List<Segment> exifSegments = filterAPP1Segments(segments);
+        final List<Segment> exifSegments = filterAPP1Segments(segments);
         if (debug) {
             System.out.println("exif_segments.size" + ": "
                     + exifSegments.size());
@@ -383,8 +383,8 @@ public class JpegImageParser extends Ima
                             + "Please send this image to the Sanselan project.");
         }
 
-        GenericSegment segment = (GenericSegment) exifSegments.get(0);
-        byte bytes[] = segment.bytes;
+        final GenericSegment segment = (GenericSegment) exifSegments.get(0);
+        final byte bytes[] = segment.bytes;
 
         // byte head[] = readBytearray("exif head", bytes, 0, 6);
         //
@@ -393,24 +393,24 @@ public class JpegImageParser extends Ima
         return getByteArrayTail("trimmed exif bytes", bytes, 6);
     }
 
-    public boolean hasExifSegment(ByteSource byteSource)
+    public boolean hasExifSegment(final ByteSource byteSource)
             throws ImageReadException, IOException {
         final boolean result[] = { false, };
 
-        JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
+        final JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
             // return false to exit before reading image data.
             public boolean beginSOS() {
                 return false;
             }
 
-            public void visitSOS(int marker, byte markerBytes[],
-                    byte imageData[]) {
+            public void visitSOS(final int marker, final byte markerBytes[],
+                    final byte imageData[]) {
             }
 
             // return false to exit traversal.
-            public boolean visitSegment(int marker, byte markerBytes[],
-                    int markerLength, byte markerLengthBytes[],
-                    byte segmentData[]) throws ImageReadException, IOException {
+            public boolean visitSegment(final int marker, final byte markerBytes[],
+                    final int markerLength, final byte markerLengthBytes[],
+                    final byte segmentData[]) throws ImageReadException, IOException {
                 if (marker == 0xffd9) {
                     return false;
                 }
@@ -431,24 +431,24 @@ public class JpegImageParser extends Ima
         return result[0];
     }
 
-    public boolean hasIptcSegment(ByteSource byteSource)
+    public boolean hasIptcSegment(final ByteSource byteSource)
             throws ImageReadException, IOException {
         final boolean result[] = { false, };
 
-        JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
+        final JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
             // return false to exit before reading image data.
             public boolean beginSOS() {
                 return false;
             }
 
-            public void visitSOS(int marker, byte markerBytes[],
-                    byte imageData[]) {
+            public void visitSOS(final int marker, final byte markerBytes[],
+                    final byte imageData[]) {
             }
 
             // return false to exit traversal.
-            public boolean visitSegment(int marker, byte markerBytes[],
-                    int markerLength, byte markerLengthBytes[],
-                    byte segmentData[]) throws ImageReadException, IOException {
+            public boolean visitSegment(final int marker, final byte markerBytes[],
+                    final int markerLength, final byte markerLengthBytes[],
+                    final byte segmentData[]) throws ImageReadException, IOException {
                 if (marker == 0xffd9) {
                     return false;
                 }
@@ -469,24 +469,24 @@ public class JpegImageParser extends Ima
         return result[0];
     }
 
-    public boolean hasXmpSegment(ByteSource byteSource)
+    public boolean hasXmpSegment(final ByteSource byteSource)
             throws ImageReadException, IOException {
         final boolean result[] = { false, };
 
-        JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
+        final JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
             // return false to exit before reading image data.
             public boolean beginSOS() {
                 return false;
             }
 
-            public void visitSOS(int marker, byte markerBytes[],
-                    byte imageData[]) {
+            public void visitSOS(final int marker, final byte markerBytes[],
+                    final byte imageData[]) {
             }
 
             // return false to exit traversal.
-            public boolean visitSegment(int marker, byte markerBytes[],
-                    int markerLength, byte markerLengthBytes[],
-                    byte segmentData[]) throws ImageReadException, IOException {
+            public boolean visitSegment(final int marker, final byte markerBytes[],
+                    final int markerLength, final byte markerLengthBytes[],
+                    final byte segmentData[]) throws ImageReadException, IOException {
                 if (marker == 0xffd9) {
                     return false;
                 }
@@ -517,25 +517,25 @@ public class JpegImageParser extends Ima
      * @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 {
 
         final List<String> result = new ArrayList<String>();
 
-        JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
+        final JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
             // return false to exit before reading image data.
             public boolean beginSOS() {
                 return false;
             }
 
-            public void visitSOS(int marker, byte markerBytes[],
-                    byte imageData[]) {
+            public void visitSOS(final int marker, final byte markerBytes[],
+                    final byte imageData[]) {
             }
 
             // return false to exit traversal.
-            public boolean visitSegment(int marker, byte markerBytes[],
-                    int markerLength, byte markerLengthBytes[],
-                    byte segmentData[]) throws ImageReadException, IOException {
+            public boolean visitSegment(final int marker, final byte markerBytes[],
+                    final int markerLength, final byte markerLengthBytes[],
+                    final byte segmentData[]) throws ImageReadException, IOException {
                 if (marker == 0xffd9) {
                     return false;
                 }
@@ -563,9 +563,9 @@ public class JpegImageParser extends Ima
         return result.get(0);
     }
 
-    public JpegPhotoshopMetadata getPhotoshopMetadata(ByteSource byteSource,
-            Map<String,Object> params) throws ImageReadException, IOException {
-        List<Segment> segments = readSegments(byteSource,
+    public JpegPhotoshopMetadata getPhotoshopMetadata(final ByteSource byteSource,
+            final Map<String,Object> params) throws ImageReadException, IOException {
+        final List<Segment> segments = readSegments(byteSource,
                 new int[] { JPEG_APP13_Marker, }, false);
 
         if ((segments == null) || (segments.size() < 1)) {
@@ -575,9 +575,9 @@ public class JpegImageParser extends Ima
         PhotoshopApp13Data photoshopApp13Data = null;
 
         for (int i = 0; i < segments.size(); i++) {
-            App13Segment segment = (App13Segment) segments.get(i);
+            final App13Segment segment = (App13Segment) segments.get(i);
 
-            PhotoshopApp13Data data = segment.parsePhotoshopSegment(params);
+            final PhotoshopApp13Data data = segment.parsePhotoshopSegment(params);
             if (data != null && photoshopApp13Data != null) {
                 throw new ImageReadException(
                         "Jpeg contains more than one Photoshop App13 segment.");
@@ -593,9 +593,9 @@ public class JpegImageParser extends Ima
     }
 
     @Override
-    public Dimension getImageSize(ByteSource byteSource, Map<String,Object> params)
+    public Dimension getImageSize(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
-        List<Segment> segments = readSegments(byteSource, new int[] {
+        final List<Segment> segments = readSegments(byteSource, new int[] {
                 // kJFIFMarker,
                 SOF0Marker,
 
@@ -613,26 +613,26 @@ public class JpegImageParser extends Ima
             throw new ImageReadException("Redundant JFIF Data Found.");
         }
 
-        SofnSegment fSOFNSegment = (SofnSegment) segments.get(0);
+        final SofnSegment fSOFNSegment = (SofnSegment) segments.get(0);
 
         return new Dimension(fSOFNSegment.width, fSOFNSegment.height);
     }
 
-    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 ImageInfo getImageInfo(ByteSource byteSource, Map<String,Object> params)
+    public ImageInfo getImageInfo(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         // List allSegments = readSegments(byteSource, null, false);
 
-        List<Segment> SOF_segments = readSegments(byteSource, new int[] {
+        final List<Segment> SOF_segments = readSegments(byteSource, new int[] {
                 // kJFIFMarker,
 
                 SOF0Marker, SOF1Marker, SOF2Marker, SOF3Marker, SOF5Marker,
@@ -649,10 +649,10 @@ public class JpegImageParser extends Ima
         // System.out.println("Incoherent SOFN Data Found: "
         // + SOF_segments.size());
 
-        List<Segment> jfifSegments = readSegments(byteSource,
+        final List<Segment> jfifSegments = readSegments(byteSource,
                 new int[] { JFIFMarker, }, true);
 
-        SofnSegment fSOFNSegment = (SofnSegment) SOF_segments.get(0);
+        final SofnSegment fSOFNSegment = (SofnSegment) SOF_segments.get(0);
         // SofnSegment fSOFNSegment = (SofnSegment) findSegment(segments,
         // SOFNmarkers);
 
@@ -660,8 +660,8 @@ public class JpegImageParser extends Ima
             throw new ImageReadException("No SOFN Data Found.");
         }
 
-        int Width = fSOFNSegment.width;
-        int Height = fSOFNSegment.height;
+        final int Width = fSOFNSegment.width;
+        final int Height = fSOFNSegment.height;
 
         JfifSegment jfifSegment = null;
 
@@ -669,7 +669,7 @@ public class JpegImageParser extends Ima
             jfifSegment = (JfifSegment) jfifSegments.get(0);
         }
 
-        List<Segment> app14Segments = readSegments(byteSource, new int[] { JPEG_APP14_Marker }, true);
+        final List<Segment> app14Segments = readSegments(byteSource, new int[] { JPEG_APP14_Marker }, true);
         App14Segment app14Segment = null;
         if (app14Segments != null && !app14Segments.isEmpty()) {
             app14Segment = (App14Segment) app14Segments.get(0);
@@ -688,7 +688,7 @@ public class JpegImageParser extends Ima
         if (jfifSegment != null) {
             x_density = jfifSegment.xDensity;
             y_density = jfifSegment.yDensity;
-            int density_units = jfifSegment.densityUnits;
+            final int density_units = jfifSegment.densityUnits;
             // JFIF_major_version = fTheJFIFSegment.JFIF_major_version;
             // JFIF_minor_version = fTheJFIFSegment.JFIF_minor_version;
 
@@ -708,29 +708,29 @@ public class JpegImageParser extends Ima
                 break;
             }
         } else {
-            JpegImageMetadata metadata = (JpegImageMetadata) getMetadata(
+            final JpegImageMetadata metadata = (JpegImageMetadata) getMetadata(
                     byteSource, params);
 
             if (metadata != null) {
                 {
-                    TiffField field = metadata
+                    final TiffField field = metadata
                             .findEXIFValue(TiffTagConstants.TIFF_TAG_XRESOLUTION);
                     if (field != null) {
                         x_density = ((Number) field.getValue()).doubleValue();
                     }
                 }
                 {
-                    TiffField field = metadata
+                    final TiffField field = metadata
                             .findEXIFValue(TiffTagConstants.TIFF_TAG_YRESOLUTION);
                     if (field != null) {
                         y_density = ((Number) field.getValue()).doubleValue();
                     }
                 }
                 {
-                    TiffField field = metadata
+                    final TiffField field = metadata
                             .findEXIFValue(TiffTagConstants.TIFF_TAG_RESOLUTION_UNIT);
                     if (field != null) {
-                        int density_units = ((Number) field.getValue())
+                        final int density_units = ((Number) field.getValue())
                                 .intValue();
 
                         switch (density_units) {
@@ -766,40 +766,40 @@ public class JpegImageParser extends Ima
             PhysicalHeightInch = (float) (Height / (y_density * units_per_inch));
         }
 
-        List<String> Comments = new ArrayList<String>();
-        List<Segment> commentSegments = readSegments(byteSource,
+        final List<String> Comments = new ArrayList<String>();
+        final List<Segment> commentSegments = readSegments(byteSource,
                 new int[] { COMMarker }, false);
         for (int i = 0; i < commentSegments.size(); i++) {
-            ComSegment comSegment = (ComSegment) commentSegments.get(i);
+            final ComSegment comSegment = (ComSegment) commentSegments.get(i);
             String comment = "";
             try {
                 comment = new String(comSegment.comment, "UTF-8");
-            } catch (UnsupportedEncodingException cannotHappen) {
+            } catch (final UnsupportedEncodingException cannotHappen) {
             }
             Comments.add(comment);
         }
 
-        int Number_of_components = fSOFNSegment.numberOfComponents;
-        int Precision = fSOFNSegment.precision;
+        final int Number_of_components = fSOFNSegment.numberOfComponents;
+        final int Precision = fSOFNSegment.precision;
 
-        int BitsPerPixel = Number_of_components * Precision;
-        ImageFormat Format = ImageFormat.IMAGE_FORMAT_JPEG;
-        String FormatName = "JPEG (Joint Photographic Experts Group) Format";
-        String MimeType = "image/jpeg";
+        final int BitsPerPixel = Number_of_components * Precision;
+        final ImageFormat Format = ImageFormat.IMAGE_FORMAT_JPEG;
+        final String FormatName = "JPEG (Joint Photographic Experts Group) Format";
+        final String MimeType = "image/jpeg";
         // we ought to count images, but don't yet.
-        int NumberOfImages = 1;
+        final int NumberOfImages = 1;
         // not accurate ... only reflects first
-        boolean isProgressive = fSOFNSegment.marker == SOF2Marker;
+        final boolean isProgressive = fSOFNSegment.marker == SOF2Marker;
 
         boolean isTransparent = false;
-        boolean usesPalette = false; // TODO: inaccurate.
+        final boolean usesPalette = false; // TODO: inaccurate.
         
         // See http://docs.oracle.com/javase/6/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html#color
         int colorType = ImageInfo.COLOR_TYPE_UNKNOWN;
         // Some images have both JFIF/APP0 and APP14.
         // JFIF is meant to win but in them APP14 is clearly right, so make it win.
         if (app14Segment != null && app14Segment.isAdobeJpegSegment()) {
-            int colorTransform = app14Segment.getAdobeColorTransform();
+            final int colorTransform = app14Segment.getAdobeColorTransform();
             if (colorTransform == App14Segment.ADOBE_COLOR_TRANSFORM_UNKNOWN) { 
                 if (Number_of_components == 3) {
                     colorType = ImageInfo.COLOR_TYPE_RGB;
@@ -829,7 +829,7 @@ public class JpegImageParser extends Ima
                 boolean have3 = false;
                 boolean have4 = false;
                 boolean haveOther = false;
-                for (SofnSegment.Component component : fSOFNSegment.components) {
+                for (final SofnSegment.Component component : fSOFNSegment.components) {
                     final int id = component.componentIdentifier;
                     if (id == 1) {
                         have1 = true;
@@ -856,7 +856,7 @@ public class JpegImageParser extends Ima
                     boolean haveC = false;
                     boolean havec = false;
                     boolean haveY = false;
-                    for (SofnSegment.Component component : fSOFNSegment.components) {
+                    for (final SofnSegment.Component component : fSOFNSegment.components) {
                         final int id = component.componentIdentifier;
                         if (id == 'R') {
                             haveR = true;
@@ -889,7 +889,7 @@ public class JpegImageParser extends Ima
                         int maxHorizontalSmaplingFactor = Integer.MIN_VALUE;
                         int minVerticalSamplingFactor = Integer.MAX_VALUE;
                         int maxVerticalSamplingFactor = Integer.MIN_VALUE;
-                        for (SofnSegment.Component component : fSOFNSegment.components) {
+                        for (final SofnSegment.Component component : fSOFNSegment.components) {
                             if (minHorizontalSamplingFactor > component.horizontalSamplingFactor) {
                                 minHorizontalSamplingFactor = component.horizontalSamplingFactor;
                             }
@@ -903,7 +903,7 @@ public class JpegImageParser extends Ima
                                 maxVerticalSamplingFactor = component.verticalSamplingFactor;
                             }
                         }
-                        boolean isSubsampled = (minHorizontalSamplingFactor != maxHorizontalSmaplingFactor) ||
+                        final boolean isSubsampled = (minHorizontalSamplingFactor != maxHorizontalSmaplingFactor) ||
                                 (minVerticalSamplingFactor != maxVerticalSamplingFactor);
                         if (Number_of_components == 3) {
                             if (isSubsampled) {
@@ -923,9 +923,9 @@ public class JpegImageParser extends Ima
             }
         }
 
-        String compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_JPEG;
+        final String compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_JPEG;
 
-        ImageInfo result = new ImageInfo(FormatDetails, BitsPerPixel, Comments,
+        final ImageInfo result = new ImageInfo(FormatDetails, BitsPerPixel, Comments,
                 Format, FormatName, Height, MimeType, NumberOfImages,
                 PhysicalHeightDpi, PhysicalHeightInch, PhysicalWidthDpi,
                 PhysicalWidthInch, Width, isProgressive, isTransparent,
@@ -1104,12 +1104,12 @@ public class JpegImageParser extends Ima
     // }
 
     @Override
-    public boolean dumpImageFile(PrintWriter pw, ByteSource byteSource)
+    public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource)
             throws ImageReadException, IOException {
         pw.println("tiff.dumpImageFile");
 
         {
-            ImageInfo imageInfo = getImageInfo(byteSource);
+            final ImageInfo imageInfo = getImageInfo(byteSource);
             if (imageInfo == null) {
                 return false;
             }
@@ -1120,7 +1120,7 @@ public class JpegImageParser extends Ima
         pw.println("");
 
         {
-            List<Segment> segments = readSegments(byteSource, null, false);
+            final List<Segment> segments = readSegments(byteSource, null, false);
 
             if (segments == null) {
                 throw new ImageReadException("No Segments Found.");
@@ -1128,9 +1128,9 @@ public class JpegImageParser extends Ima
 
             for (int d = 0; d < segments.size(); d++) {
 
-                Segment segment = segments.get(d);
+                final Segment segment = segments.get(d);
 
-                NumberFormat nf = NumberFormat.getIntegerInstance();
+                final NumberFormat nf = NumberFormat.getIntegerInstance();
                 // this.debugNumber("found, marker: ", marker, 4);
                 pw.println(d + ": marker: "
                         + Integer.toHexString(segment.marker) + ", "

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegPhotoshopMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegPhotoshopMetadata.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegPhotoshopMetadata.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegPhotoshopMetadata.java Tue Dec  4 17:23:16 2012
@@ -34,10 +34,10 @@ public class JpegPhotoshopMetadata exten
     public JpegPhotoshopMetadata(final PhotoshopApp13Data photoshopApp13Data) {
         this.photoshopApp13Data = photoshopApp13Data;
 
-        List<IptcRecord> records = photoshopApp13Data.getRecords();
+        final List<IptcRecord> records = photoshopApp13Data.getRecords();
         Collections.sort(records, IptcRecord.COMPARATOR);
         for (int j = 0; j < records.size(); j++) {
-            IptcRecord element = records.get(j);
+            final IptcRecord element = records.get(j);
             if (element.iptcType != IptcTypes.RECORD_VERSION) {
                 add(element.getIptcTypeName(), element.getValue());
             }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java Tue Dec  4 17:23:16 2012
@@ -44,7 +44,7 @@ public class JpegUtils extends BinaryFil
                 IOException;
     }
 
-    public void traverseJFIF(ByteSource byteSource, Visitor visitor)
+    public void traverseJFIF(final ByteSource byteSource, final Visitor visitor)
             throws ImageReadException,
             // ImageWriteException,
             IOException {
@@ -56,18 +56,18 @@ public class JpegUtils extends BinaryFil
             readAndVerifyBytes(is, SOI,
                     "Not a Valid JPEG File: doesn't begin with 0xffd8");
 
-            ByteOrder byteOrder = getByteOrder();
+            final ByteOrder byteOrder = getByteOrder();
 
             int markerCount;
             for (markerCount = 0; true; markerCount++) {
-                byte[] markerBytes = new byte[2];
+                final byte[] markerBytes = new byte[2];
                 do {
                     markerBytes[0] = markerBytes[1];
                     markerBytes[1] = readByte("marker", is,
                             "Could not read marker");
                 } while ((0xff & markerBytes[0]) != 0xff
                         || (0xff & markerBytes[1]) == 0xff);
-                int marker = ((0xff & markerBytes[0]) << 8)
+                final int marker = ((0xff & markerBytes[0]) << 8)
                         | (0xff & markerBytes[1]);
 
                 // Debug.debug("marker", marker + " (0x" +
@@ -79,21 +79,21 @@ public class JpegUtils extends BinaryFil
                         return;
                     }
 
-                    byte imageData[] = getStreamBytes(is);
+                    final byte imageData[] = getStreamBytes(is);
                     visitor.visitSOS(marker, markerBytes, imageData);
                     break;
                 }
 
-                byte segmentLengthBytes[] = readByteArray("segmentLengthBytes",
+                final byte segmentLengthBytes[] = readByteArray("segmentLengthBytes",
                         2, is, "segmentLengthBytes");
-                int segmentLength = convertByteArrayToShort("segmentLength",
+                final int segmentLength = convertByteArrayToShort("segmentLength",
                         segmentLengthBytes, byteOrder);
 
                 // Debug.debug("segmentLength", segmentLength + " (0x" +
                 // Integer.toHexString(segmentLength) + ")");
                 // Debug.debug("segmentLengthBytes", segmentLengthBytes);
 
-                byte segmentData[] = readByteArray("Segment Data",
+                final byte segmentData[] = readByteArray("Segment Data",
                         segmentLength - 2, is,
                         "Invalid Segment: insufficient data");
 
@@ -112,13 +112,13 @@ public class JpegUtils extends BinaryFil
                 if (is != null) {
                     is.close();
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 Debug.debug(e);
             }
         }
     }
 
-    public static String getMarkerName(int marker) {
+    public static String getMarkerName(final int marker) {
         switch (marker) {
         case SOS_Marker:
             return "SOS_Marker";
@@ -177,25 +177,25 @@ public class JpegUtils extends BinaryFil
         }
     }
 
-    public void dumpJFIF(ByteSource byteSource) throws ImageReadException,
+    public void dumpJFIF(final ByteSource byteSource) throws ImageReadException,
             IOException {
-        Visitor visitor = new Visitor() {
+        final Visitor visitor = new Visitor() {
             // return false to exit before reading image data.
             public boolean beginSOS() {
                 return true;
             }
 
-            public void visitSOS(int marker, byte markerBytes[],
-                    byte imageData[]) {
+            public void visitSOS(final int marker, final byte markerBytes[],
+                    final byte imageData[]) {
                 Debug.debug("SOS marker.  " + imageData.length
                         + " bytes of image data.");
                 Debug.debug("");
             }
 
             // return false to exit traversal.
-            public boolean visitSegment(int marker, byte markerBytes[],
-                    int segmentLength, byte segmentLengthBytes[],
-                    byte segmentData[]) {
+            public boolean visitSegment(final int marker, final byte markerBytes[],
+                    final int segmentLength, final byte segmentLengthBytes[],
+                    final byte segmentData[]) {
                 Debug.debug("Segment marker: " + Integer.toHexString(marker)
                         + " (" + getMarkerName(marker) + "), "
                         + segmentData.length + " bytes of segment data.");

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/ZigZag.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/ZigZag.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/ZigZag.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/ZigZag.java Tue Dec  4 17:23:16 2012
@@ -27,13 +27,13 @@ public class ZigZag {
         35, 36, 48, 49, 57, 58, 62, 63
     };
 
-    public static void zigZagToBlock(int[] zz, int[] block) {
+    public static void zigZagToBlock(final int[] zz, final int[] block) {
         for (int i = 0; i < 64; i++) {
             block[i] = zz[zigZag[i]];
         }
     }
 
-    public static void blockToZigZag(int[] block, int[] zz) {
+    public static void blockToZigZag(final int[] block, final int[] zz) {
         for (int i = 0; i < 64; i++) {
             zz[zigZag[i]] = block[i];
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Dct.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Dct.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Dct.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Dct.java Tue Dec  4 17:23:16 2012
@@ -91,19 +91,19 @@ public class Dct {
     private static final float Q = C2 - C6;
     private static final float R = C2 + C6;
 
-    public static void scaleQuantizationVector(float[] vector) {
+    public static void scaleQuantizationVector(final float[] vector) {
         for (int x = 0; x < 8; x++) {
             vector[x] *= dctScalingFactors[x];
         }
     }
 
-    public static void scaleDequantizationVector(float[] vector) {
+    public static void scaleDequantizationVector(final float[] vector) {
         for (int x = 0; x < 8; x++) {
             vector[x] *= idctScalingFactors[x];
         }
     }
 
-    public static void scaleQuantizationMatrix(float[] matrix) {
+    public static void scaleQuantizationMatrix(final float[] matrix) {
         for (int y = 0; y < 8; y++) {
             for (int x = 0; x < 8; x++) {
                 matrix[8 * y + x] *= dctScalingFactors[y]
@@ -112,7 +112,7 @@ public class Dct {
         }
     }
 
-    public static void scaleDequantizationMatrix(float[] matrix) {
+    public static void scaleDequantizationMatrix(final float[] matrix) {
         for (int y = 0; y < 8; y++) {
             for (int x = 0; x < 8; x++) {
                 matrix[8 * y + x] *= idctScalingFactors[y]
@@ -126,36 +126,36 @@ public class Dct {
      * "JPEG still image data compression standard", by Pennebaker and Mitchell,
      * chapter 4, figure "4-8".
      */
-    public static void forwardDCT8(float[] vector) {
-        float a00 = vector[0] + vector[7];
-        float a10 = vector[1] + vector[6];
-        float a20 = vector[2] + vector[5];
-        float a30 = vector[3] + vector[4];
-        float a40 = vector[3] - vector[4];
-        float a50 = vector[2] - vector[5];
-        float a60 = vector[1] - vector[6];
-        float a70 = vector[0] - vector[7];
-
-        float a01 = a00 + a30;
-        float a11 = a10 + a20;
-        float a21 = a10 - a20;
-        float a31 = a00 - a30;
+    public static void forwardDCT8(final float[] vector) {
+        final float a00 = vector[0] + vector[7];
+        final float a10 = vector[1] + vector[6];
+        final float a20 = vector[2] + vector[5];
+        final float a30 = vector[3] + vector[4];
+        final float a40 = vector[3] - vector[4];
+        final float a50 = vector[2] - vector[5];
+        final float a60 = vector[1] - vector[6];
+        final float a70 = vector[0] - vector[7];
+
+        final float a01 = a00 + a30;
+        final float a11 = a10 + a20;
+        final float a21 = a10 - a20;
+        final float a31 = a00 - a30;
         // Avoid some negations:
         // float a41 = -a40 - a50;
-        float neg_a41 = a40 + a50;
-        float a51 = a50 + a60;
-        float a61 = a60 + a70;
-
-        float a22 = a21 + a31;
-
-        float a23 = a22 * A1;
-        float mul5 = (a61 - neg_a41) * A5;
-        float a43 = neg_a41 * A2 - mul5;
-        float a53 = a51 * A3;
-        float a63 = a61 * A4 - mul5;
+        final float neg_a41 = a40 + a50;
+        final float a51 = a50 + a60;
+        final float a61 = a60 + a70;
+
+        final float a22 = a21 + a31;
+
+        final float a23 = a22 * A1;
+        final float mul5 = (a61 - neg_a41) * A5;
+        final float a43 = neg_a41 * A2 - mul5;
+        final float a53 = a51 * A3;
+        final float a63 = a61 * A4 - mul5;
 
-        float a54 = a70 + a53;
-        float a74 = a70 - a53;
+        final float a54 = a70 + a53;
+        final float a74 = a70 - a53;
 
         vector[0] = a01 + a11;
         vector[4] = a01 - a11;
@@ -167,7 +167,7 @@ public class Dct {
         vector[3] = a74 - a43;
     }
 
-    public static void forwardDCT8x8(float[] matrix) {
+    public static void forwardDCT8x8(final float[] matrix) {
         float a00, a10, a20, a30, a40, a50, a60, a70;
         float a01, a11, a21, a31, neg_a41, a51, a61;
         float a22, a23, mul5, a43, a53, a63;
@@ -248,41 +248,41 @@ public class Dct {
      * easy equations and properly explains constants and scaling factors. Terms
      * have been inlined and the negation optimized out of existence.
      */
-    public static void inverseDCT8(float[] vector) {
+    public static void inverseDCT8(final float[] vector) {
         // B1
-        float a2 = vector[2] - vector[6];
-        float a3 = vector[2] + vector[6];
-        float a4 = vector[5] - vector[3];
-        float tmp1 = vector[1] + vector[7];
-        float tmp2 = vector[3] + vector[5];
-        float a5 = tmp1 - tmp2;
-        float a6 = vector[1] - vector[7];
-        float a7 = tmp1 + tmp2;
+        final float a2 = vector[2] - vector[6];
+        final float a3 = vector[2] + vector[6];
+        final float a4 = vector[5] - vector[3];
+        final float tmp1 = vector[1] + vector[7];
+        final float tmp2 = vector[3] + vector[5];
+        final float a5 = tmp1 - tmp2;
+        final float a6 = vector[1] - vector[7];
+        final float a7 = tmp1 + tmp2;
 
         // M
-        float tmp4 = C6 * (a4 + a6);
+        final float tmp4 = C6 * (a4 + a6);
         // Eliminate the negative:
         // float b4 = -Q*a4 - tmp4;
-        float neg_b4 = Q * a4 + tmp4;
-        float b6 = R * a6 - tmp4;
-        float b2 = a2 * C4;
-        float b5 = a5 * C4;
+        final float neg_b4 = Q * a4 + tmp4;
+        final float b6 = R * a6 - tmp4;
+        final float b2 = a2 * C4;
+        final float b5 = a5 * C4;
 
         // A1
-        float tmp3 = b6 - a7;
-        float n0 = tmp3 - b5;
-        float n1 = vector[0] - vector[4];
-        float n2 = b2 - a3;
-        float n3 = vector[0] + vector[4];
-        float neg_n5 = neg_b4;
+        final float tmp3 = b6 - a7;
+        final float n0 = tmp3 - b5;
+        final float n1 = vector[0] - vector[4];
+        final float n2 = b2 - a3;
+        final float n3 = vector[0] + vector[4];
+        final float neg_n5 = neg_b4;
 
         // A2
-        float m3 = n1 + n2;
-        float m4 = n3 + a3;
-        float m5 = n1 - n2;
-        float m6 = n3 - a3;
+        final float m3 = n1 + n2;
+        final float m4 = n3 + a3;
+        final float m5 = n1 - n2;
+        final float m6 = n3 - a3;
         // float m7 = n5 - n0;
-        float neg_m7 = neg_n5 + n0;
+        final float neg_m7 = neg_n5 + n0;
 
         // A3
         vector[0] = m4 + a7;
@@ -295,7 +295,7 @@ public class Dct {
         vector[7] = m4 - a7;
     }
 
-    public static void inverseDCT8x8(float[] matrix) {
+    public static void inverseDCT8x8(final float[] matrix) {
         float a2, a3, a4, tmp1, tmp2, a5, a6, a7;
         float tmp4, neg_b4, b6, b2, b5;
         float tmp3, n0, n1, n2, n3, neg_n5;



Mime
View raw message