You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by eb...@apache.org on 2013/11/27 12:21:16 UTC

svn commit: r1545998 [2/5] - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/ main/java/org/apache/commons/imaging/common/ main/java/org/apache/commons/imaging/common/mylzw/ main/java/org/apache/commons/imaging/formats/bmp/ m...

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=1545998&r1=1545997&r2=1545998&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 Wed Nov 27 11:21:14 2013
@@ -112,8 +112,7 @@ public class IcoImageParser extends Imag
         public final int iconCount; // IconCount (2 bytes), number of icons in
                                     // this file.
 
-        public FileHeader(final int reserved, final int iconType,
-                final int iconCount) {
+        public FileHeader(final int reserved, final int iconType, final int iconCount) {
             this.reserved = reserved;
             this.iconType = iconType;
             this.iconCount = iconCount;
@@ -128,132 +127,128 @@ public class IcoImageParser extends Imag
         }
     }
 
-    private FileHeader readFileHeader(final InputStream is)
-            throws ImageReadException, IOException {
-        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");
+    private FileHeader readFileHeader(final InputStream is) throws ImageReadException, IOException {
+        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 "
-                    + Reserved);
+        if (reserved != 0) {
+            throw new ImageReadException("Not a Valid ICO File: reserved is " + reserved);
         }
-        if (IconType != 1 && IconType != 2) {
-            throw new ImageReadException("Not a Valid ICO File: icon type is "
-                    + IconType);
+        if (iconType != 1 && iconType != 2) {
+            throw new ImageReadException("Not a Valid ICO File: icon type is " + iconType);
         }
 
-        return new FileHeader(Reserved, IconType, IconCount);
+        return new FileHeader(reserved, iconType, iconCount);
 
     }
 
     private static class IconInfo {
-        public final byte Width;
-        public final byte Height;
-        public final byte ColorCount;
-        public final byte Reserved;
-        public final int Planes;
-        public final int BitCount;
-        public final int ImageSize;
-        public final int ImageOffset;
+        public final byte width;
+        public final byte height;
+        public final byte colorCount;
+        public final byte reserved;
+        public final int planes;
+        public final int bitCount;
+        public final int imageSize;
+        public final int imageOffset;
 
         public IconInfo(final byte width, final byte height,
                 final byte colorCount, final byte reserved, final int planes,
                 final int bitCount, final int imageSize, final int imageOffset) {
-            Width = width;
-            Height = height;
-            ColorCount = colorCount;
-            Reserved = reserved;
-            Planes = planes;
-            BitCount = bitCount;
-            ImageSize = imageSize;
-            ImageOffset = imageOffset;
+            this.width = width;
+            this.height = height;
+            this.colorCount = colorCount;
+            this.reserved = reserved;
+            this.planes = planes;
+            this.bitCount = bitCount;
+            this.imageSize = imageSize;
+            this.imageOffset = imageOffset;
         }
 
         public void dump(final PrintWriter pw) {
             pw.println("IconInfo");
-            pw.println("Width: " + Width);
-            pw.println("Height: " + Height);
-            pw.println("ColorCount: " + ColorCount);
-            pw.println("Reserved: " + Reserved);
-            pw.println("Planes: " + Planes);
-            pw.println("BitCount: " + BitCount);
-            pw.println("ImageSize: " + ImageSize);
-            pw.println("ImageOffset: " + ImageOffset);
+            pw.println("Width: " + width);
+            pw.println("Height: " + height);
+            pw.println("ColorCount: " + colorCount);
+            pw.println("Reserved: " + reserved);
+            pw.println("Planes: " + planes);
+            pw.println("BitCount: " + bitCount);
+            pw.println("ImageSize: " + imageSize);
+            pw.println("ImageOffset: " + imageOffset);
         }
     }
 
     private IconInfo readIconInfo(final InputStream is) throws IOException {
         // Width (1 byte), Width of Icon (1 to 255)
-        final 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)
-        final 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.
-        final 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)
-        final 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
-        final 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)
-        final 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
-        final 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
-        final 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);
+        return new IconInfo(width, height, colorCount, reserved, planes, bitCount, imageSize, imageOffset);
     }
 
     private static class BitmapHeader {
-        public final int Size;
-        public final int Width;
-        public final int Height;
-        public final int Planes;
-        public final int BitCount;
-        public final int Compression;
-        public final int SizeImage;
-        public final int XPelsPerMeter;
-        public final int YPelsPerMeter;
-        public final int ColorsUsed;
-        public final int ColorsImportant;
+        public final int size;
+        public final int width;
+        public final int height;
+        public final int planes;
+        public final int bitCount;
+        public final int compression;
+        public final int sizeImage;
+        public final int xPelsPerMeter;
+        public final int yPelsPerMeter;
+        public final int colorsUsed;
+        public final int colorsImportant;
 
         public BitmapHeader(final int size, final int width, final int height,
                 final int planes, final int bitCount, final int compression,
                 final int sizeImage, final int pelsPerMeter,
                 final int pelsPerMeter2, final int colorsUsed,
                 final int colorsImportant) {
-            Size = size;
-            Width = width;
-            Height = height;
-            Planes = planes;
-            BitCount = bitCount;
-            Compression = compression;
-            SizeImage = sizeImage;
-            XPelsPerMeter = pelsPerMeter;
-            YPelsPerMeter = pelsPerMeter2;
-            ColorsUsed = colorsUsed;
-            ColorsImportant = colorsImportant;
+            this.size = size;
+            this.width = width;
+            this.height = height;
+            this.planes = planes;
+            this.bitCount = bitCount;
+            this.compression = compression;
+            this.sizeImage = sizeImage;
+            xPelsPerMeter = pelsPerMeter;
+            yPelsPerMeter = pelsPerMeter2;
+            this.colorsUsed = colorsUsed;
+            this.colorsImportant = colorsImportant;
         }
 
         public void dump(final PrintWriter pw) {
             pw.println("BitmapHeader");
 
-            pw.println("Size: " + Size);
-            pw.println("Width: " + Width);
-            pw.println("Height: " + Height);
-            pw.println("Planes: " + Planes);
-            pw.println("BitCount: " + BitCount);
-            pw.println("Compression: " + Compression);
-            pw.println("SizeImage: " + SizeImage);
-            pw.println("XPelsPerMeter: " + XPelsPerMeter);
-            pw.println("YPelsPerMeter: " + YPelsPerMeter);
-            pw.println("ColorsUsed: " + ColorsUsed);
-            pw.println("ColorsImportant: " + ColorsImportant);
+            pw.println("Size: " + size);
+            pw.println("Width: " + width);
+            pw.println("Height: " + height);
+            pw.println("Planes: " + planes);
+            pw.println("BitCount: " + bitCount);
+            pw.println("Compression: " + compression);
+            pw.println("SizeImage: " + sizeImage);
+            pw.println("XPelsPerMeter: " + xPelsPerMeter);
+            pw.println("YPelsPerMeter: " + yPelsPerMeter);
+            pw.println("ColorsUsed: " + colorsUsed);
+            pw.println("ColorsImportant: " + colorsImportant);
         }
     }
 
@@ -324,21 +319,21 @@ public class IcoImageParser extends Imag
     private IconData readBitmapIconData(final byte[] iconData, final IconInfo fIconInfo)
             throws ImageReadException, IOException {
         final ByteArrayInputStream is = new ByteArrayInputStream(iconData);
-        final int Size = read4Bytes("Size", is, "Not a Valid ICO File"); // Size (4
+        final int size = read4Bytes("size", is, "Not a Valid ICO File"); // Size (4
                                                                    // bytes),
                                                                    // size of
                                                                    // this
                                                                    // structure
                                                                    // (always
                                                                    // 40)
-        final 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)
-        final 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
@@ -349,12 +344,12 @@ public class IcoImageParser extends Imag
                                                                        // map
                                                                        // (iconinfo.height
                                                                        // * 2)
-        final 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
-        final 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
@@ -362,7 +357,7 @@ public class IcoImageParser extends Imag
                                                                            // iconinfo
                                                                            // for
                                                                            // details)
-        int Compression = read4Bytes("Compression", is, "Not a Valid ICO File"); // Compression
+        int compression = read4Bytes("compression", is, "Not a Valid ICO File"); // Compression
                                                                                  // (4
                                                                                  // bytes),
                                                                                  // we
@@ -370,7 +365,7 @@ public class IcoImageParser extends Imag
                                                                                  // use
                                                                                  // this
                                                                                  // (0)
-        final 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
@@ -378,13 +373,13 @@ public class IcoImageParser extends Imag
                                                                              // use
                                                                              // this
                                                                              // (0)
-        final 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)
-        final 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)
-        final 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
@@ -392,46 +387,44 @@ public class IcoImageParser extends Imag
                                                                                // use
                                                                                // this
                                                                                // (0)
-        final 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;
-        int GreenMask = 0;
-        int BlueMask = 0;
-        int AlphaMask = 0;
-        if (Compression == 3) {
-            RedMask = read4Bytes("RedMask", is, "Not a Valid ICO File");
-            GreenMask = read4Bytes("GreenMask", is, "Not a Valid ICO File");
-            BlueMask = read4Bytes("BlueMask", is, "Not a Valid ICO File");
-        }
-        final byte[] RestOfFile = readBytes("RestOfFile", is, is.available());
-
-        if (Size != 40) {
-            throw new ImageReadException(
-                    "Not a Valid ICO File: Wrong bitmap header size " + Size);
-        }
-        if (Planes != 1) {
-            throw new ImageReadException(
-                    "Not a Valid ICO File: Planes can't be " + Planes);
+        int redMask = 0;
+        int greenMask = 0;
+        int blueMask = 0;
+        int alphaMask = 0;
+        if (compression == 3) {
+            redMask = read4Bytes("redMask", is, "Not a Valid ICO File");
+            greenMask = read4Bytes("greenMask", is, "Not a Valid ICO File");
+            blueMask = read4Bytes("blueMask", is, "Not a Valid ICO File");
+        }
+        final byte[] restOfFile = readBytes("RestOfFile", is, is.available());
+
+        if (size != 40) {
+            throw new ImageReadException("Not a Valid ICO File: Wrong bitmap header size " + size);
+        }
+        if (planes != 1) {
+            throw new ImageReadException("Not a Valid ICO File: Planes can't be " + planes);
         }
 
-        if (Compression == 0 && BitCount == 32) {
+        if (compression == 0 && bitCount == 32) {
             // 32 BPP RGB icons need an alpha channel, but BMP files don't have
             // one unless BI_BITFIELDS is used...
-            Compression = 3;
-            RedMask = 0x00ff0000;
-            GreenMask = 0x0000ff00;
-            BlueMask = 0x000000ff;
-            AlphaMask = 0xff000000;
+            compression = 3;
+            redMask = 0x00ff0000;
+            greenMask = 0x0000ff00;
+            blueMask = 0x000000ff;
+            alphaMask = 0xff000000;
         }
 
-        final BitmapHeader header = new BitmapHeader(Size, Width, Height, Planes,
-                BitCount, Compression, SizeImage, XPelsPerMeter, YPelsPerMeter,
-                ColorsUsed, ColorsImportant);
-
-        final int bitmapPixelsOffset = 14 + 56 + 4 * ((ColorsUsed == 0 && BitCount <= 8) ? (1 << BitCount)
-                : ColorsUsed);
-        final int bitmapSize = 14 + 56 + RestOfFile.length;
+        final BitmapHeader header = new BitmapHeader(size, width, height, planes,
+                bitCount, compression, sizeImage, xPelsPerMeter, yPelsPerMeter,
+                colorsUsed, colorsImportant);
+
+        final int bitmapPixelsOffset = 14 + 56 + 4 * ((colorsUsed == 0 && bitCount <= 8) ? (1 << bitCount)
+                : colorsUsed);
+        final int bitmapSize = 14 + 56 + restOfFile.length;
 
         final ByteArrayOutputStream baos = new ByteArrayOutputStream(bitmapSize);
         BinaryOutputStream bos = null;
@@ -447,31 +440,29 @@ public class IcoImageParser extends Imag
             bos.write4Bytes(bitmapPixelsOffset);
     
             bos.write4Bytes(56);
-            bos.write4Bytes(Width);
-            bos.write4Bytes(Height / 2);
-            bos.write2Bytes(Planes);
-            bos.write2Bytes(BitCount);
-            bos.write4Bytes(Compression);
-            bos.write4Bytes(SizeImage);
-            bos.write4Bytes(XPelsPerMeter);
-            bos.write4Bytes(YPelsPerMeter);
-            bos.write4Bytes(ColorsUsed);
-            bos.write4Bytes(ColorsImportant);
-            bos.write4Bytes(RedMask);
-            bos.write4Bytes(GreenMask);
-            bos.write4Bytes(BlueMask);
-            bos.write4Bytes(AlphaMask);
-            bos.write(RestOfFile);
+            bos.write4Bytes(width);
+            bos.write4Bytes(height / 2);
+            bos.write2Bytes(planes);
+            bos.write2Bytes(bitCount);
+            bos.write4Bytes(compression);
+            bos.write4Bytes(sizeImage);
+            bos.write4Bytes(xPelsPerMeter);
+            bos.write4Bytes(yPelsPerMeter);
+            bos.write4Bytes(colorsUsed);
+            bos.write4Bytes(colorsImportant);
+            bos.write4Bytes(redMask);
+            bos.write4Bytes(greenMask);
+            bos.write4Bytes(blueMask);
+            bos.write4Bytes(alphaMask);
+            bos.write(restOfFile);
             bos.flush();
             canThrow = true;
         } finally {
             IoUtils.closeQuietly(canThrow, bos);
         }
 
-        final ByteArrayInputStream bmpInputStream = new ByteArrayInputStream(
-                baos.toByteArray());
-        final BufferedImage bmpImage = new BmpImageParser().getBufferedImage(
-                bmpInputStream, null);
+        final ByteArrayInputStream bmpInputStream = new ByteArrayInputStream(baos.toByteArray());
+        final BufferedImage bmpImage = new BmpImageParser().getBufferedImage(bmpInputStream, null);
 
         // Transparency map is optional with 32 BPP icons, because they already
         // have
@@ -480,25 +471,25 @@ public class IcoImageParser extends Imag
         // display the icon on a < 32 BPP screen. But it's still used instead of
         // alpha
         // if the image would be completely transparent with alpha...
-        int t_scanline_size = (Width + 7) / 8;
+        int t_scanline_size = (width + 7) / 8;
         if ((t_scanline_size % 4) != 0) {
             t_scanline_size += 4 - (t_scanline_size % 4); // pad scanline to 4
                                                           // byte size.
         }
-        final int tcolor_map_size_bytes = t_scanline_size * (Height / 2);
-        byte[] transparency_map = null;
+        final int colorMapSizeBytes = t_scanline_size * (height / 2);
+        byte[] transparencyMap = null;
         try {
-            transparency_map = this.readBytes("transparency_map",
-                    bmpInputStream, tcolor_map_size_bytes,
+            transparencyMap = this.readBytes("transparency_map",
+                    bmpInputStream, colorMapSizeBytes,
                     "Not a Valid ICO File");
         } catch (final IOException ioEx) {
-            if (BitCount != 32) {
+            if (bitCount != 32) {
                 throw ioEx;
             }
         }
 
         boolean allAlphasZero = true;
-        if (BitCount == 32) {
+        if (bitCount == 32) {
             for (int y = 0; allAlphasZero && y < bmpImage.getHeight(); y++) {
                 for (int x = 0; x < bmpImage.getWidth(); x++) {
                     if ((bmpImage.getRGB(x, y) & 0xff000000) != 0) {
@@ -515,10 +506,10 @@ public class IcoImageParser extends Imag
             for (int y = 0; y < resultImage.getHeight(); y++) {
                 for (int x = 0; x < resultImage.getWidth(); x++) {
                     int alpha = 0xff;
-                    if (transparency_map != null) {
-                        final int alpha_byte = 0xff & transparency_map[t_scanline_size
+                    if (transparencyMap != null) {
+                        final int alphaByte = 0xff & transparencyMap[t_scanline_size
                                 * (bmpImage.getHeight() - y - 1) + (x / 8)];
-                        alpha = 0x01 & (alpha_byte >> (7 - (x % 8)));
+                        alpha = 0x01 & (alphaByte >> (7 - (x % 8)));
                         alpha = (alpha == 0) ? 0xff : 0x00;
                     }
                     resultImage.setRGB(x, y, (alpha << 24)
@@ -569,7 +560,7 @@ public class IcoImageParser extends Imag
             final IconData[] fIconDatas = new IconData[fileHeader.iconCount];
             for (int i = 0; i < fileHeader.iconCount; i++) {
                 final byte[] iconData = byteSource.getBlock(
-                        fIconInfos[i].ImageOffset, fIconInfos[i].ImageSize);
+                        fIconInfos[i].imageOffset, fIconInfos[i].imageSize);
                 fIconDatas[i] = readIconData(iconData, fIconInfos[i]);
             }
 
@@ -749,22 +740,22 @@ public class IcoImageParser extends Imag
             }
         }
 
-        int bit_cache = 0;
-        int bits_in_cache = 0;
-        final int row_padding = scanline_size - (bitCount * src.getWidth() + 7) / 8;
+        int bitCache = 0;
+        int bitsInCache = 0;
+        final int rowPadding = scanline_size - (bitCount * src.getWidth() + 7) / 8;
         for (int y = src.getHeight() - 1; y >= 0; y--) {
             for (int x = 0; x < src.getWidth(); x++) {
                 final int argb = src.getRGB(x, y);
                 if (bitCount < 8) {
                     final int rgb = 0xffffff & argb;
                     final int index = palette.getPaletteIndex(rgb);
-                    bit_cache <<= bitCount;
-                    bit_cache |= index;
-                    bits_in_cache += bitCount;
-                    if (bits_in_cache >= 8) {
-                        bos.write(0xff & bit_cache);
-                        bit_cache = 0;
-                        bits_in_cache = 0;
+                    bitCache <<= bitCount;
+                    bitCache |= index;
+                    bitsInCache += bitCount;
+                    if (bitsInCache >= 8) {
+                        bos.write(0xff & bitCache);
+                        bitCache = 0;
+                        bitsInCache = 0;
                     }
                 } else if (bitCount == 8) {
                     final int rgb = 0xffffff & argb;
@@ -782,14 +773,14 @@ public class IcoImageParser extends Imag
                 }
             }
 
-            if (bits_in_cache > 0) {
-                bit_cache <<= (8 - bits_in_cache);
-                bos.write(0xff & bit_cache);
-                bit_cache = 0;
-                bits_in_cache = 0;
+            if (bitsInCache > 0) {
+                bitCache <<= (8 - bitsInCache);
+                bos.write(0xff & bitCache);
+                bitCache = 0;
+                bitsInCache = 0;
             }
 
-            for (int x = 0; x < row_padding; x++) {
+            for (int x = 0; x < rowPadding; x++) {
                 bos.write(0);
             }
         }
@@ -799,23 +790,23 @@ public class IcoImageParser extends Imag
             for (int x = 0; x < src.getWidth(); x++) {
                 final int argb = src.getRGB(x, y);
                 final int alpha = 0xff & (argb >> 24);
-                bit_cache <<= 1;
+                bitCache <<= 1;
                 if (alpha == 0) {
-                    bit_cache |= 1;
+                    bitCache |= 1;
                 }
-                bits_in_cache++;
-                if (bits_in_cache >= 8) {
-                    bos.write(0xff & bit_cache);
-                    bit_cache = 0;
-                    bits_in_cache = 0;
+                bitsInCache++;
+                if (bitsInCache >= 8) {
+                    bos.write(0xff & bitCache);
+                    bitCache = 0;
+                    bitsInCache = 0;
                 }
             }
 
-            if (bits_in_cache > 0) {
-                bit_cache <<= (8 - bits_in_cache);
-                bos.write(0xff & bit_cache);
-                bit_cache = 0;
-                bits_in_cache = 0;
+            if (bitsInCache > 0) {
+                bitCache <<= (8 - bitsInCache);
+                bos.write(0xff & bitCache);
+                bitCache = 0;
+                bitsInCache = 0;
             }
 
             for (int x = 0; x < t_row_padding; x++) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegConstants.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegConstants.java Wed Nov 27 11:21:14 2013
@@ -86,46 +86,46 @@ public final class JpegConstants {
             (byte) 0xff, (byte) 0xd9 });
 
     public static final int JPEG_APP0 = 0xE0;
-    public static final int JPEG_APP0_Marker = (0xff00) | (JPEG_APP0);
-    public static final int JPEG_APP1_Marker = (0xff00) | (JPEG_APP0 + 1);
-    public static final int JPEG_APP2_Marker = (0xff00) | (JPEG_APP0 + 2);
-    public static final int JPEG_APP13_Marker = (0xff00) | (JPEG_APP0 + 13);
-    public static final int JPEG_APP14_Marker = (0xff00) | (JPEG_APP0 + 14);
-    public static final int JPEG_APP15_Marker = (0xff00) | (JPEG_APP0 + 15);
-
-    public static final int JFIFMarker = 0xFFE0;
-    public static final int SOF0Marker = 0xFFc0;
-    public static final int SOF1Marker = 0xFFc0 + 0x1;
-    public static final int SOF2Marker = 0xFFc0 + 0x2;
-    public static final int SOF3Marker = 0xFFc0 + 0x3;
-    public static final int DHTMarker = 0xFFc0 + 0x4;
-    public static final int SOF5Marker = 0xFFc0 + 0x5;
-    public static final int SOF6Marker = 0xFFc0 + 0x6;
-    public static final int SOF7Marker = 0xFFc0 + 0x7;
-    public static final int SOF8Marker = 0xFFc0 + 0x8;
-    public static final int SOF9Marker = 0xFFc0 + 0x9;
-    public static final int SOF10Marker = 0xFFc0 + 0xa;
-    public static final int SOF11Marker = 0xFFc0 + 0xb;
-    public static final int DACMarker = 0xFFc0 + 0xc;
-    public static final int SOF13Marker = 0xFFc0 + 0xd;
-    public static final int SOF14Marker = 0xFFc0 + 0xe;
-    public static final int SOF15Marker = 0xFFc0 + 0xf;
-
-    public static final int EOIMarker = 0xFFd9;
-    public static final int SOS_Marker = 0xFFda;
-    public static final int DQTMarker = 0xFFdb;
-    public static final int DNLMarker = 0xFFdc;
-    public static final int COMMarker = 0xFFfe;
+    public static final int JPEG_APP0_MARKER = (0xff00) | (JPEG_APP0);
+    public static final int JPEG_APP1_MARKER = (0xff00) | (JPEG_APP0 + 1);
+    public static final int JPEG_APP2_MARKER = (0xff00) | (JPEG_APP0 + 2);
+    public static final int JPEG_APP13_MARKER = (0xff00) | (JPEG_APP0 + 13);
+    public static final int JPEG_APP14_MARKER = (0xff00) | (JPEG_APP0 + 14);
+    public static final int JPEG_APP15_MARKER = (0xff00) | (JPEG_APP0 + 15);
+
+    public static final int JFIF_MARKER = 0xFFE0;
+    public static final int SOF0_MARKER = 0xFFc0;
+    public static final int SOF1_MARKER = 0xFFc0 + 0x1;
+    public static final int SOF2_MARKER = 0xFFc0 + 0x2;
+    public static final int SOF3_MARKER = 0xFFc0 + 0x3;
+    public static final int DHT_MARKER = 0xFFc0 + 0x4;
+    public static final int SOF5_MARKER = 0xFFc0 + 0x5;
+    public static final int SOF6_MARKER = 0xFFc0 + 0x6;
+    public static final int SOF7_MARKER = 0xFFc0 + 0x7;
+    public static final int SOF8_MARKER = 0xFFc0 + 0x8;
+    public static final int SOF9_MARKER = 0xFFc0 + 0x9;
+    public static final int SOF10_MARKER = 0xFFc0 + 0xa;
+    public static final int SOF11_MARKER = 0xFFc0 + 0xb;
+    public static final int DAC_MARKER = 0xFFc0 + 0xc;
+    public static final int SOF13_MARKER = 0xFFc0 + 0xd;
+    public static final int SOF14_MARKER = 0xFFc0 + 0xe;
+    public static final int SOF15_MARKER = 0xFFc0 + 0xf;
+
+    public static final int EOI_MARKER = 0xFFd9;
+    public static final int SOS_MARKER = 0xFFda;
+    public static final int DQT_MARKER = 0xFFdb;
+    public static final int DNL_MARKER = 0xFFdc;
+    public static final int COM_MARKER = 0xFFfe;
 
     public static final List<Integer> MARKERS = Collections
-            .unmodifiableList(Arrays.asList(JPEG_APP0, JPEG_APP0_Marker,
-                    JPEG_APP1_Marker, JPEG_APP2_Marker, JPEG_APP13_Marker,
-                    JPEG_APP14_Marker, JPEG_APP15_Marker, JFIFMarker,
-                    SOF0Marker, SOF1Marker, SOF2Marker, SOF3Marker, DHTMarker,
-                    SOF5Marker, SOF6Marker, SOF7Marker, SOF8Marker, SOF9Marker,
-                    SOF10Marker, SOF11Marker, DACMarker, SOF13Marker,
-                    SOF14Marker, SOF15Marker, EOIMarker, SOS_Marker, DQTMarker,
-                    DNLMarker, COMMarker));
+            .unmodifiableList(Arrays.asList(JPEG_APP0, JPEG_APP0_MARKER,
+                    JPEG_APP1_MARKER, JPEG_APP2_MARKER, JPEG_APP13_MARKER,
+                    JPEG_APP14_MARKER, JPEG_APP15_MARKER, JFIF_MARKER,
+                    SOF0_MARKER, SOF1_MARKER, SOF2_MARKER, SOF3_MARKER, DHT_MARKER,
+                    SOF5_MARKER, SOF6_MARKER, SOF7_MARKER, SOF8_MARKER, SOF9_MARKER,
+                    SOF10_MARKER, SOF11_MARKER, DAC_MARKER, SOF13_MARKER,
+                    SOF14_MARKER, SOF15_MARKER, EOI_MARKER, SOS_MARKER, DQT_MARKER,
+                    DNL_MARKER, COM_MARKER));
 
     public static final BinaryConstant ICC_PROFILE_LABEL = new BinaryConstant(
             new byte[] { 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49,

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=1545998&r1=1545997&r2=1545998&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 Wed Nov 27 11:21:14 2013
@@ -117,19 +117,19 @@ public class JpegImageParser extends Ima
         final JpegImageParser parser = this;
         final int[] sofnSegments = {
                 // kJFIFMarker,
-                JpegConstants.SOF0Marker,
-                JpegConstants.SOF1Marker,
-                JpegConstants.SOF2Marker,
-                JpegConstants.SOF3Marker,
-                JpegConstants.SOF5Marker,
-                JpegConstants.SOF6Marker,
-                JpegConstants.SOF7Marker,
-                JpegConstants.SOF9Marker,
-                JpegConstants.SOF10Marker,
-                JpegConstants.SOF11Marker,
-                JpegConstants.SOF13Marker,
-                JpegConstants.SOF14Marker,
-                JpegConstants.SOF15Marker,
+                JpegConstants.SOF0_MARKER,
+                JpegConstants.SOF1_MARKER,
+                JpegConstants.SOF2_MARKER,
+                JpegConstants.SOF3_MARKER,
+                JpegConstants.SOF5_MARKER,
+                JpegConstants.SOF6_MARKER,
+                JpegConstants.SOF7_MARKER,
+                JpegConstants.SOF9_MARKER,
+                JpegConstants.SOF10_MARKER,
+                JpegConstants.SOF11_MARKER,
+                JpegConstants.SOF13_MARKER,
+                JpegConstants.SOF14_MARKER,
+                JpegConstants.SOF15_MARKER,
         };
 
         final JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
@@ -147,7 +147,7 @@ public class JpegImageParser extends Ima
             public boolean visitSegment(final int marker, final byte[] markerBytes,
                     final int markerLength, final byte[] markerLengthBytes,
                     final byte[] segmentData) throws ImageReadException, IOException {
-                if (marker == JpegConstants.EOIMarker) {
+                if (marker == JpegConstants.EOI_MARKER) {
                     return false;
                 }
 
@@ -161,23 +161,23 @@ public class JpegImageParser extends Ima
                     return true;
                 }
 
-                if (marker == JpegConstants.JPEG_APP13_Marker) {
+                if (marker == JpegConstants.JPEG_APP13_MARKER) {
                     // Debug.debug("app 13 segment data", segmentData.length);
                     result.add(new App13Segment(parser, marker, segmentData));
-                } else if (marker == JpegConstants.JPEG_APP14_Marker) {
+                } else if (marker == JpegConstants.JPEG_APP14_MARKER) {
                     result.add(new App14Segment(marker, segmentData));
-                } else if (marker == JpegConstants.JPEG_APP2_Marker) {
+                } else if (marker == JpegConstants.JPEG_APP2_MARKER) {
                     result.add(new App2Segment(marker, segmentData));
-                } else if (marker == JpegConstants.JFIFMarker) {
+                } else if (marker == JpegConstants.JFIF_MARKER) {
                     result.add(new JfifSegment(marker, segmentData));
                 } else if (Arrays.binarySearch(sofnSegments, marker) >= 0) {
                     result.add(new SofnSegment(marker, segmentData));
-                } else if (marker == JpegConstants.DQTMarker) {
+                } else if (marker == JpegConstants.DQT_MARKER) {
                     result.add(new DqtSegment(marker, segmentData));
-                } else if ((marker >= JpegConstants.JPEG_APP1_Marker)
-                        && (marker <= JpegConstants.JPEG_APP15_Marker)) {
+                } else if ((marker >= JpegConstants.JPEG_APP1_MARKER)
+                        && (marker <= JpegConstants.JPEG_APP15_MARKER)) {
                     result.add(new UnknownSegment(marker, segmentData));
-                } else if (marker == JpegConstants.COMMarker) {
+                } else if (marker == JpegConstants.COM_MARKER) {
                     result.add(new ComSegment(marker, segmentData));
                 }
 
@@ -203,13 +203,13 @@ public class JpegImageParser extends Ima
         }
     }
 
-    private byte[] assembleSegments(final List<App2Segment> segments, final boolean start_with_zero)
+    private byte[] assembleSegments(final List<App2Segment> segments, final boolean startWithZero)
             throws ImageReadException {
         if (segments.isEmpty()) {
             throw new ImageReadException("No App2 Segments Found.");
         }
 
-        final int markerCount = segments.get(0).num_markers;
+        final int markerCount = segments.get(0).numMarkers;
 
         if (segments.size() != markerCount) {
             throw new ImageReadException("App2 Segments Missing.  Found: "
@@ -218,37 +218,37 @@ public class JpegImageParser extends Ima
 
         Collections.sort(segments);
 
-        final int offset = start_with_zero ? 0 : 1;
+        final int offset = startWithZero ? 0 : 1;
 
         int total = 0;
         for (int i = 0; i < segments.size(); i++) {
             final App2Segment segment = segments.get(i);
 
-            if ((i + offset) != segment.cur_marker) {
+            if ((i + offset) != segment.curMarker) {
                 dumpSegments(segments);
                 throw new ImageReadException(
                         "Incoherent App2 Segment Ordering.  i: " + i
-                                + ", segment[" + i + "].cur_marker: "
-                                + segment.cur_marker + ".");
+                                + ", segment[" + i + "].curMarker: "
+                                + segment.curMarker + ".");
             }
 
-            if (markerCount != segment.num_markers) {
+            if (markerCount != segment.numMarkers) {
                 dumpSegments(segments);
                 throw new ImageReadException(
                         "Inconsistent App2 Segment Count info.  markerCount: "
                                 + markerCount + ", segment[" + i
-                                + "].num_markers: " + segment.num_markers + ".");
+                                + "].numMarkers: " + segment.numMarkers + ".");
             }
 
-            total += segment.icc_bytes.length;
+            total += segment.iccBytes.length;
         }
 
         final byte[] result = new byte[total];
         int progress = 0;
 
         for (App2Segment segment : segments) {
-            System.arraycopy(segment.icc_bytes, 0, result, progress, segment.icc_bytes.length);
-            progress += segment.icc_bytes.length;
+            System.arraycopy(segment.iccBytes, 0, result, progress, segment.iccBytes.length);
+            progress += segment.iccBytes.length;
         }
 
         return result;
@@ -261,7 +261,7 @@ public class JpegImageParser extends Ima
         for (int i = 0; i < v.size(); i++) {
             final App2Segment segment = (App2Segment) v.get(i);
 
-            Debug.debug((i) + ": " + segment.cur_marker + " / " + segment.num_markers);
+            Debug.debug((i) + ": " + segment.curMarker + " / " + segment.numMarkers);
         }
         Debug.debug();
     }
@@ -275,14 +275,14 @@ public class JpegImageParser extends Ima
     public byte[] getICCProfileBytes(final ByteSource byteSource, final Map<String, Object> params)
             throws ImageReadException, IOException {
         final List<Segment> segments = readSegments(byteSource,
-                new int[] { JpegConstants.JPEG_APP2_Marker, }, false);
+                new int[] { JpegConstants.JPEG_APP2_MARKER, }, false);
 
         final List<App2Segment> filtered = new ArrayList<App2Segment>();
         if (segments != null) {
             // throw away non-icc profile app2 segments.
             for (Segment s : segments) {
                 final App2Segment segment = (App2Segment) s;
-                if (segment.icc_bytes != null) {
+                if (segment.iccBytes != null) {
                     filtered.add(segment);
                 }
             }
@@ -358,7 +358,7 @@ public class JpegImageParser extends Ima
     public byte[] getExifRawData(final ByteSource byteSource)
             throws ImageReadException, IOException {
         final List<Segment> segments = readSegments(byteSource,
-                new int[] { JpegConstants.JPEG_APP1_Marker, }, false);
+                new int[] { JpegConstants.JPEG_APP1_MARKER, }, false);
 
         if ((segments == null) || (segments.isEmpty())) {
             return null;
@@ -416,7 +416,7 @@ public class JpegImageParser extends Ima
                     return false;
                 }
 
-                if (marker == JpegConstants.JPEG_APP1_Marker) {
+                if (marker == JpegConstants.JPEG_APP1_MARKER) {
                     if (startsWith(segmentData, JpegConstants.EXIF_IDENTIFIER_CODE)) {
                         result[0] = true;
                         return false;
@@ -455,7 +455,7 @@ public class JpegImageParser extends Ima
                     return false;
                 }
 
-                if (marker == JpegConstants.JPEG_APP13_Marker) {
+                if (marker == JpegConstants.JPEG_APP13_MARKER) {
                     if (new IptcParser().isPhotoshopJpegSegment(segmentData)) {
                         result[0] = true;
                         return false;
@@ -494,7 +494,7 @@ public class JpegImageParser extends Ima
                     return false;
                 }
 
-                if (marker == JpegConstants.JPEG_APP1_Marker) {
+                if (marker == JpegConstants.JPEG_APP1_MARKER) {
                     if (new JpegXmpParser().isXmpJpegSegment(segmentData)) {
                         result[0] = true;
                         return false;
@@ -544,7 +544,7 @@ public class JpegImageParser extends Ima
                     return false;
                 }
 
-                if (marker == JpegConstants.JPEG_APP1_Marker) {
+                if (marker == JpegConstants.JPEG_APP1_MARKER) {
                     if (new JpegXmpParser().isXmpJpegSegment(segmentData)) {
                         result.add(new JpegXmpParser()
                                 .parseXmpJpegSegment(segmentData));
@@ -570,7 +570,7 @@ public class JpegImageParser extends Ima
     public JpegPhotoshopMetadata getPhotoshopMetadata(final ByteSource byteSource,
             final Map<String, Object> params) throws ImageReadException, IOException {
         final List<Segment> segments = readSegments(byteSource,
-                new int[] { JpegConstants.JPEG_APP13_Marker, }, false);
+                new int[] { JpegConstants.JPEG_APP13_MARKER, }, false);
 
         if ((segments == null) || (segments.isEmpty())) {
             return null;
@@ -601,19 +601,19 @@ public class JpegImageParser extends Ima
             throws ImageReadException, IOException {
         final List<Segment> segments = readSegments(byteSource, new int[] {
                 // kJFIFMarker,
-                JpegConstants.SOF0Marker,
-                JpegConstants.SOF1Marker,
-                JpegConstants.SOF2Marker,
-                JpegConstants.SOF3Marker,
-                JpegConstants.SOF5Marker,
-                JpegConstants.SOF6Marker,
-                JpegConstants.SOF7Marker,
-                JpegConstants.SOF9Marker,
-                JpegConstants.SOF10Marker,
-                JpegConstants.SOF11Marker,
-                JpegConstants.SOF13Marker,
-                JpegConstants.SOF14Marker,
-                JpegConstants.SOF15Marker,
+                JpegConstants.SOF0_MARKER,
+                JpegConstants.SOF1_MARKER,
+                JpegConstants.SOF2_MARKER,
+                JpegConstants.SOF3_MARKER,
+                JpegConstants.SOF5_MARKER,
+                JpegConstants.SOF6_MARKER,
+                JpegConstants.SOF7_MARKER,
+                JpegConstants.SOF9_MARKER,
+                JpegConstants.SOF10_MARKER,
+                JpegConstants.SOF11_MARKER,
+                JpegConstants.SOF13_MARKER,
+                JpegConstants.SOF14_MARKER,
+                JpegConstants.SOF15_MARKER,
 
         }, true);
 
@@ -647,19 +647,19 @@ public class JpegImageParser extends Ima
         final List<Segment> SOF_segments = readSegments(byteSource, new int[] {
                 // kJFIFMarker,
 
-                JpegConstants.SOF0Marker,
-                JpegConstants.SOF1Marker,
-                JpegConstants.SOF2Marker,
-                JpegConstants.SOF3Marker,
-                JpegConstants.SOF5Marker,
-                JpegConstants.SOF6Marker,
-                JpegConstants.SOF7Marker,
-                JpegConstants.SOF9Marker,
-                JpegConstants.SOF10Marker,
-                JpegConstants.SOF11Marker,
-                JpegConstants.SOF13Marker,
-                JpegConstants.SOF14Marker,
-                JpegConstants.SOF15Marker,
+                JpegConstants.SOF0_MARKER,
+                JpegConstants.SOF1_MARKER,
+                JpegConstants.SOF2_MARKER,
+                JpegConstants.SOF3_MARKER,
+                JpegConstants.SOF5_MARKER,
+                JpegConstants.SOF6_MARKER,
+                JpegConstants.SOF7_MARKER,
+                JpegConstants.SOF9_MARKER,
+                JpegConstants.SOF10_MARKER,
+                JpegConstants.SOF11_MARKER,
+                JpegConstants.SOF13_MARKER,
+                JpegConstants.SOF14_MARKER,
+                JpegConstants.SOF15_MARKER,
 
         }, false);
 
@@ -672,7 +672,7 @@ public class JpegImageParser extends Ima
         // + SOF_segments.size());
 
         final List<Segment> jfifSegments = readSegments(byteSource,
-                new int[] { JpegConstants.JFIFMarker, }, true);
+                new int[] { JpegConstants.JFIF_MARKER, }, true);
 
         final SofnSegment fSOFNSegment = (SofnSegment) SOF_segments.get(0);
         // SofnSegment fSOFNSegment = (SofnSegment) findSegment(segments,
@@ -682,8 +682,8 @@ public class JpegImageParser extends Ima
             throw new ImageReadException("No SOFN Data Found.");
         }
 
-        final int Width = fSOFNSegment.width;
-        final int Height = fSOFNSegment.height;
+        final int width = fSOFNSegment.width;
+        final int height = fSOFNSegment.height;
 
         JfifSegment jfifSegment = null;
 
@@ -691,7 +691,7 @@ public class JpegImageParser extends Ima
             jfifSegment = (JfifSegment) jfifSegments.get(0);
         }
 
-        final List<Segment> app14Segments = readSegments(byteSource, new int[] { JpegConstants.JPEG_APP14_Marker }, true);
+        final List<Segment> app14Segments = readSegments(byteSource, new int[] { JpegConstants.JPEG_APP14_MARKER}, true);
         App14Segment app14Segment = null;
         if (app14Segments != null && !app14Segments.isEmpty()) {
             app14Segment = (App14Segment) app14Segments.get(0);
@@ -700,31 +700,31 @@ public class JpegImageParser extends Ima
         // JfifSegment fTheJFIFSegment = (JfifSegment) findSegment(segments,
         // kJFIFMarker);
 
-        double x_density = -1.0;
-        double y_density = -1.0;
-        double units_per_inch = -1.0;
+        double xDensity = -1.0;
+        double yDensity = -1.0;
+        double unitsPerInch = -1.0;
         // int JFIF_major_version;
         // int JFIF_minor_version;
-        String FormatDetails;
+        String formatDetails;
 
         if (jfifSegment != null) {
-            x_density = jfifSegment.xDensity;
-            y_density = jfifSegment.yDensity;
-            final int density_units = jfifSegment.densityUnits;
+            xDensity = jfifSegment.xDensity;
+            yDensity = jfifSegment.yDensity;
+            final int densityUnits = jfifSegment.densityUnits;
             // JFIF_major_version = fTheJFIFSegment.JFIF_major_version;
             // JFIF_minor_version = fTheJFIFSegment.JFIF_minor_version;
 
-            FormatDetails = "Jpeg/JFIF v." + jfifSegment.jfifMajorVersion + "."
+            formatDetails = "Jpeg/JFIF v." + jfifSegment.jfifMajorVersion + "."
                     + jfifSegment.jfifMinorVersion;
 
-            switch (density_units) {
+            switch (densityUnits) {
             case 0:
                 break;
             case 1: // inches
-                units_per_inch = 1.0;
+                unitsPerInch = 1.0;
                 break;
             case 2: // cms
-                units_per_inch = 2.54;
+                unitsPerInch = 2.54;
                 break;
             default:
                 break;
@@ -738,31 +738,30 @@ public class JpegImageParser extends Ima
                     final TiffField field = metadata
                             .findEXIFValue(TiffTagConstants.TIFF_TAG_XRESOLUTION);
                     if (field != null) {
-                        x_density = ((Number) field.getValue()).doubleValue();
+                        xDensity = ((Number) field.getValue()).doubleValue();
                     }
                 }
                 {
                     final TiffField field = metadata
                             .findEXIFValue(TiffTagConstants.TIFF_TAG_YRESOLUTION);
                     if (field != null) {
-                        y_density = ((Number) field.getValue()).doubleValue();
+                        yDensity = ((Number) field.getValue()).doubleValue();
                     }
                 }
                 {
                     final TiffField field = metadata
                             .findEXIFValue(TiffTagConstants.TIFF_TAG_RESOLUTION_UNIT);
                     if (field != null) {
-                        final int density_units = ((Number) field.getValue())
-                                .intValue();
+                        final int densityUnits = ((Number) field.getValue()).intValue();
 
-                        switch (density_units) {
+                        switch (densityUnits) {
                         case 1:
                             break;
                         case 2: // inches
-                            units_per_inch = 1.0;
+                            unitsPerInch = 1.0;
                             break;
                         case 3: // cms
-                            units_per_inch = 2.54;
+                            unitsPerInch = 2.54;
                             break;
                         default:
                             break;
@@ -772,25 +771,25 @@ public class JpegImageParser extends Ima
                 }
             }
 
-            FormatDetails = "Jpeg/DCM";
+            formatDetails = "Jpeg/DCM";
 
         }
 
-        int PhysicalHeightDpi = -1;
-        float PhysicalHeightInch = -1;
-        int PhysicalWidthDpi = -1;
-        float PhysicalWidthInch = -1;
+        int physicalHeightDpi = -1;
+        float physicalHeightInch = -1;
+        int physicalWidthDpi = -1;
+        float physicalWidthInch = -1;
 
-        if (units_per_inch > 0) {
-            PhysicalWidthDpi = (int) Math.round(x_density * units_per_inch);
-            PhysicalWidthInch = (float) (Width / (x_density * units_per_inch));
-            PhysicalHeightDpi = (int) Math.round(y_density * units_per_inch);
-            PhysicalHeightInch = (float) (Height / (y_density * units_per_inch));
+        if (unitsPerInch > 0) {
+            physicalWidthDpi = (int) Math.round(xDensity * unitsPerInch);
+            physicalWidthInch = (float) (width / (xDensity * unitsPerInch));
+            physicalHeightDpi = (int) Math.round(yDensity * unitsPerInch);
+            physicalHeightInch = (float) (height / (yDensity * unitsPerInch));
         }
 
-        final List<String> Comments = new ArrayList<String>();
+        final List<String> comments = new ArrayList<String>();
         final List<Segment> commentSegments = readSegments(byteSource,
-                new int[] { JpegConstants.COMMarker }, false);
+                new int[] { JpegConstants.COM_MARKER}, false);
         for (Segment commentSegment : commentSegments) {
             final ComSegment comSegment = (ComSegment) commentSegment;
             String comment = "";
@@ -798,22 +797,22 @@ public class JpegImageParser extends Ima
                 comment = new String(comSegment.getComment(), "UTF-8");
             } catch (final UnsupportedEncodingException cannotHappen) { // NOPMD - can't happen
             }
-            Comments.add(comment);
+            comments.add(comment);
         }
 
-        final int Number_of_components = fSOFNSegment.numberOfComponents;
-        final int Precision = fSOFNSegment.precision;
+        final int numberOfComponents = fSOFNSegment.numberOfComponents;
+        final int precision = fSOFNSegment.precision;
 
-        final int BitsPerPixel = Number_of_components * Precision;
-        final ImageFormat Format = ImageFormats.JPEG;
-        final String FormatName = "JPEG (Joint Photographic Experts Group) Format";
-        final String MimeType = "image/jpeg";
+        final int bitsPerPixel = numberOfComponents * precision;
+        final ImageFormat format = ImageFormats.JPEG;
+        final String formatName = "JPEG (Joint Photographic Experts Group) Format";
+        final String mimeType = "image/jpeg";
         // we ought to count images, but don't yet.
-        final int NumberOfImages = 1;
+        final int numberOfImages = 1;
         // not accurate ... only reflects first
-        final boolean isProgressive = fSOFNSegment.marker == JpegConstants.SOF2Marker;
+        final boolean progressive = fSOFNSegment.marker == JpegConstants.SOF2_MARKER;
 
-        boolean isTransparent = false;
+        boolean transparent = false;
         final boolean usesPalette = false; // TODO: inaccurate.
         
         // See http://docs.oracle.com/javase/6/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html#color
@@ -823,9 +822,9 @@ public class JpegImageParser extends Ima
         if (app14Segment != null && app14Segment.isAdobeJpegSegment()) {
             final int colorTransform = app14Segment.getAdobeColorTransform();
             if (colorTransform == App14Segment.ADOBE_COLOR_TRANSFORM_UNKNOWN) { 
-                if (Number_of_components == 3) {
+                if (numberOfComponents == 3) {
                     colorType = ImageInfo.COLOR_TYPE_RGB;
-                } else if (Number_of_components == 4) {
+                } else if (numberOfComponents == 4) {
                     colorType = ImageInfo.COLOR_TYPE_CMYK;
                 }
             } else if (colorTransform == App14Segment.ADOBE_COLOR_TRANSFORM_YCbCr) {
@@ -834,18 +833,18 @@ public class JpegImageParser extends Ima
                 colorType = ImageInfo.COLOR_TYPE_YCCK;
             }
         } else if (jfifSegment != null) {
-            if (Number_of_components == 1) {
+            if (numberOfComponents == 1) {
                 colorType = ImageInfo.COLOR_TYPE_GRAYSCALE;
-            } else if (Number_of_components == 3) {
+            } else if (numberOfComponents == 3) {
                 colorType = ImageInfo.COLOR_TYPE_YCbCr;
             }
         } else {
-            if (Number_of_components == 1) {
+            if (numberOfComponents == 1) {
                 colorType = ImageInfo.COLOR_TYPE_GRAYSCALE;
-            } else if (Number_of_components == 2) {
+            } else if (numberOfComponents == 2) {
                 colorType = ImageInfo.COLOR_TYPE_GRAYSCALE;
-                isTransparent = true;
-            } else if (Number_of_components == 3 || Number_of_components == 4) {
+                transparent = true;
+            } else if (numberOfComponents == 3 || numberOfComponents == 4) {
                 boolean have1 = false;
                 boolean have2 = false;
                 boolean have3 = false;
@@ -865,11 +864,11 @@ public class JpegImageParser extends Ima
                         haveOther = true;
                     }
                 }
-                if (Number_of_components == 3 && have1 && have2 && have3 && !have4 && !haveOther) {
+                if (numberOfComponents == 3 && have1 && have2 && have3 && !have4 && !haveOther) {
                     colorType = ImageInfo.COLOR_TYPE_YCbCr;
-                } else if (Number_of_components == 4 && have1 && have2 && have3 && have4 && !haveOther) {
+                } else if (numberOfComponents == 4 && have1 && have2 && have3 && have4 && !haveOther) {
                     colorType = ImageInfo.COLOR_TYPE_YCbCr;
-                    isTransparent = true;
+                    transparent = true;
                 } else {
                     boolean haveR = false;
                     boolean haveG = false;
@@ -900,12 +899,12 @@ public class JpegImageParser extends Ima
                         colorType = ImageInfo.COLOR_TYPE_RGB;
                     } else if (haveR && haveG && haveB && haveA && !haveC && !havec && !haveY) {
                         colorType = ImageInfo.COLOR_TYPE_RGB;
-                        isTransparent = true;
+                        transparent = true;
                     } else if (haveY && haveC && havec && !haveR && !haveG && !haveB && !haveA) {
                         colorType = ImageInfo.COLOR_TYPE_YCC;
                     } else if (haveY && haveC && havec && haveA && !haveR && !haveG && !haveB) {
                         colorType = ImageInfo.COLOR_TYPE_YCC;
-                        isTransparent = true;
+                        transparent = true;
                     } else {
                         int minHorizontalSamplingFactor = Integer.MAX_VALUE;
                         int maxHorizontalSmaplingFactor = Integer.MIN_VALUE;
@@ -927,13 +926,13 @@ public class JpegImageParser extends Ima
                         }
                         final boolean isSubsampled = (minHorizontalSamplingFactor != maxHorizontalSmaplingFactor) ||
                                 (minVerticalSamplingFactor != maxVerticalSamplingFactor);
-                        if (Number_of_components == 3) {
+                        if (numberOfComponents == 3) {
                             if (isSubsampled) {
                                 colorType = ImageInfo.COLOR_TYPE_YCbCr;
                             } else {
                                 colorType = ImageInfo.COLOR_TYPE_RGB;
                             }
-                        } else if (Number_of_components == 4) {
+                        } else if (numberOfComponents == 4) {
                             if (isSubsampled) {
                                 colorType = ImageInfo.COLOR_TYPE_YCCK;
                             } else {
@@ -947,10 +946,10 @@ public class JpegImageParser extends Ima
 
         final String compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_JPEG;
 
-        return new ImageInfo(FormatDetails, BitsPerPixel, Comments,
-                Format, FormatName, Height, MimeType, NumberOfImages,
-                PhysicalHeightDpi, PhysicalHeightInch, PhysicalWidthDpi,
-                PhysicalWidthInch, Width, isProgressive, isTransparent,
+        return new ImageInfo(formatDetails, bitsPerPixel, comments,
+                format, formatName, height, mimeType, numberOfImages,
+                physicalHeightDpi, physicalHeightInch, physicalWidthDpi,
+                physicalWidthInch, width, progressive, transparent,
                 usesPalette, colorType, compressionAlgorithm);
     }
 
@@ -961,9 +960,9 @@ public class JpegImageParser extends Ima
     // List allSegments = readSegments(byteSource, null, false);
     //
     // final int SOF_MARKERS[] = new int[]{
-    // SOF0Marker, SOF1Marker, SOF2Marker, SOF3Marker, SOF5Marker,
-    // SOF6Marker, SOF7Marker, SOF9Marker, SOF10Marker, SOF11Marker,
-    // SOF13Marker, SOF14Marker, SOF15Marker,
+    // SOF0_MARKER, SOF1_MARKER, SOF2_MARKER, SOF3_MARKER, SOF5_MARKER,
+    // SOF6_MARKER, SOF7_MARKER, SOF9_MARKER, SOF10_MARKER, SOF11_MARKER,
+    // SOF13_MARKER, SOF14_MARKER, SOF15_MARKER,
     // };
     //
     // List sofMarkers = new ArrayList();
@@ -974,7 +973,7 @@ public class JpegImageParser extends Ima
     // throw new ImageReadException("No SOFN Data Found.");
     //
     // List jfifMarkers = new ArrayList();
-    // jfifMarkers.add(new Integer(JFIFMarker));
+    // jfifMarkers.add(new Integer(JFIF_MARKER));
     // List jfifSegments = filterSegments(allSegments, jfifMarkers);
     //
     // SofnSegment firstSOFNSegment = (SofnSegment) SOFSegments.get(0);
@@ -1098,7 +1097,7 @@ public class JpegImageParser extends Ima
     // // we ought to count images, but don't yet.
     // int NumberOfImages = -1;
     // // not accurate ... only reflects first
-    // boolean isProgressive = firstSOFNSegment.marker == SOF2Marker;
+    // boolean isProgressive = firstSOFNSegment.marker == SOF2_MARKER;
     //
     // boolean isTransparent = false; // TODO: inaccurate.
     // boolean usesPalette = false; // TODO: inaccurate.

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=1545998&r1=1545997&r2=1545998&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 Wed Nov 27 11:21:14 2013
@@ -67,7 +67,7 @@ public class JpegUtils extends BinaryFil
                 final int marker = ((0xff & markerBytes[0]) << 8)
                         | (0xff & markerBytes[1]);
 
-                if (marker == JpegConstants.EOIMarker || marker == JpegConstants.SOS_Marker) {
+                if (marker == JpegConstants.EOI_MARKER || marker == JpegConstants.SOS_MARKER) {
                     if (!visitor.beginSOS()) {
                         canThrow = true;
                         return;
@@ -100,58 +100,58 @@ public class JpegUtils extends BinaryFil
 
     public static String getMarkerName(final int marker) {
         switch (marker) {
-        case JpegConstants.SOS_Marker:
-            return "SOS_Marker";
+        case JpegConstants.SOS_MARKER:
+            return "SOS_MARKER";
             // case JPEG_APP0 :
             // return "JPEG_APP0";
-            // case JPEG_APP0_Marker :
-            // return "JPEG_APP0_Marker";
-        case JpegConstants.JPEG_APP1_Marker:
-            return "JPEG_APP1_Marker";
-        case JpegConstants.JPEG_APP2_Marker:
-            return "JPEG_APP2_Marker";
-        case JpegConstants.JPEG_APP13_Marker:
-            return "JPEG_APP13_Marker";
-        case JpegConstants.JPEG_APP14_Marker:
-            return "JPEG_APP14_Marker";
-        case JpegConstants.JPEG_APP15_Marker:
-            return "JPEG_APP15_Marker";
-        case JpegConstants.JFIFMarker:
-            return "JFIFMarker";
-        case JpegConstants.SOF0Marker:
-            return "SOF0Marker";
-        case JpegConstants.SOF1Marker:
-            return "SOF1Marker";
-        case JpegConstants.SOF2Marker:
-            return "SOF2Marker";
-        case JpegConstants.SOF3Marker:
-            return "SOF3Marker";
-        case JpegConstants.DHTMarker:
-            return "SOF4Marker";
-        case JpegConstants.SOF5Marker:
-            return "SOF5Marker";
-        case JpegConstants.SOF6Marker:
-            return "SOF6Marker";
-        case JpegConstants.SOF7Marker:
-            return "SOF7Marker";
-        case JpegConstants.SOF8Marker:
-            return "SOF8Marker";
-        case JpegConstants.SOF9Marker:
-            return "SOF9Marker";
-        case JpegConstants.SOF10Marker:
-            return "SOF10Marker";
-        case JpegConstants.SOF11Marker:
-            return "SOF11Marker";
-        case JpegConstants.DACMarker:
-            return "DACMarker";
-        case JpegConstants.SOF13Marker:
-            return "SOF13Marker";
-        case JpegConstants.SOF14Marker:
-            return "SOF14Marker";
-        case JpegConstants.SOF15Marker:
-            return "SOF15Marker";
-        case JpegConstants.DQTMarker:
-            return "DQTMarker";
+            // case JPEG_APP0_MARKER :
+            // return "JPEG_APP0_MARKER";
+        case JpegConstants.JPEG_APP1_MARKER:
+            return "JPEG_APP1_MARKER";
+        case JpegConstants.JPEG_APP2_MARKER:
+            return "JPEG_APP2_MARKER";
+        case JpegConstants.JPEG_APP13_MARKER:
+            return "JPEG_APP13_MARKER";
+        case JpegConstants.JPEG_APP14_MARKER:
+            return "JPEG_APP14_MARKER";
+        case JpegConstants.JPEG_APP15_MARKER:
+            return "JPEG_APP15_MARKER";
+        case JpegConstants.JFIF_MARKER:
+            return "JFIF_MARKER";
+        case JpegConstants.SOF0_MARKER:
+            return "SOF0_MARKER";
+        case JpegConstants.SOF1_MARKER:
+            return "SOF1_MARKER";
+        case JpegConstants.SOF2_MARKER:
+            return "SOF2_MARKER";
+        case JpegConstants.SOF3_MARKER:
+            return "SOF3_MARKER";
+        case JpegConstants.DHT_MARKER:
+            return "SOF4_MARKER";
+        case JpegConstants.SOF5_MARKER:
+            return "SOF5_MARKER";
+        case JpegConstants.SOF6_MARKER:
+            return "SOF6_MARKER";
+        case JpegConstants.SOF7_MARKER:
+            return "SOF7_MARKER";
+        case JpegConstants.SOF8_MARKER:
+            return "SOF8_MARKER";
+        case JpegConstants.SOF9_MARKER:
+            return "SOF9_MARKER";
+        case JpegConstants.SOF10_MARKER:
+            return "SOF10_MARKER";
+        case JpegConstants.SOF11_MARKER:
+            return "SOF11_MARKER";
+        case JpegConstants.DAC_MARKER:
+            return "DAC_MARKER";
+        case JpegConstants.SOF13_MARKER:
+            return "SOF13_MARKER";
+        case JpegConstants.SOF14_MARKER:
+            return "SOF14_MARKER";
+        case JpegConstants.SOF15_MARKER:
+            return "SOF15_MARKER";
+        case JpegConstants.DQT_MARKER:
+            return "DQT_MARKER";
         default:
             return "Unknown";
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java Wed Nov 27 11:21:14 2013
@@ -172,28 +172,28 @@ public class JpegDecoder extends BinaryF
             final int segmentLength, final byte[] segmentLengthBytes, final byte[] segmentData)
             throws ImageReadException, IOException {
         final int[] sofnSegments = {
-                JpegConstants.SOF0Marker,
-                JpegConstants.SOF1Marker,
-                JpegConstants.SOF2Marker,
-                JpegConstants.SOF3Marker,
-                JpegConstants.SOF5Marker,
-                JpegConstants.SOF6Marker,
-                JpegConstants.SOF7Marker,
-                JpegConstants.SOF9Marker,
-                JpegConstants.SOF10Marker,
-                JpegConstants.SOF11Marker,
-                JpegConstants.SOF13Marker,
-                JpegConstants.SOF14Marker,
-                JpegConstants.SOF15Marker,
+                JpegConstants.SOF0_MARKER,
+                JpegConstants.SOF1_MARKER,
+                JpegConstants.SOF2_MARKER,
+                JpegConstants.SOF3_MARKER,
+                JpegConstants.SOF5_MARKER,
+                JpegConstants.SOF6_MARKER,
+                JpegConstants.SOF7_MARKER,
+                JpegConstants.SOF9_MARKER,
+                JpegConstants.SOF10_MARKER,
+                JpegConstants.SOF11_MARKER,
+                JpegConstants.SOF13_MARKER,
+                JpegConstants.SOF14_MARKER,
+                JpegConstants.SOF15_MARKER,
         };
 
         if (Arrays.binarySearch(sofnSegments, marker) >= 0) {
-            if (marker != JpegConstants.SOF0Marker) {
+            if (marker != JpegConstants.SOF0_MARKER) {
                 throw new ImageReadException("Only sequential, baseline JPEGs "
                         + "are supported at the moment");
             }
             sofnSegment = new SofnSegment(marker, segmentData);
-        } else if (marker == JpegConstants.DQTMarker) {
+        } else if (marker == JpegConstants.DQT_MARKER) {
             final DqtSegment dqtSegment = new DqtSegment(marker, segmentData);
             for (int i = 0; i < dqtSegment.quantizationTables.size(); i++) {
                 final DqtSegment.QuantizationTable table = dqtSegment.quantizationTables
@@ -214,7 +214,7 @@ public class JpegDecoder extends BinaryF
                 Dct.scaleDequantizationMatrix(quantizationMatrixFloat);
                 scaledQuantizationTables[table.destinationIdentifier] = quantizationMatrixFloat;
             }
-        } else if (marker == JpegConstants.DHTMarker) {
+        } else if (marker == JpegConstants.DHT_MARKER) {
             final DhtSegment dhtSegment = new DhtSegment(marker, segmentData);
             for (int i = 0; i < dhtSegment.huffmanTables.size(); i++) {
                 final DhtSegment.HuffmanTable table = dhtSegment.huffmanTables.get(i);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java Wed Nov 27 11:21:14 2013
@@ -44,7 +44,7 @@ class JpegInputStream {
                     throw new ImageReadException("Premature End of File");
                 }
                 if (b2 != 0) {
-                    if (b2 == (0xff & JpegConstants.DNLMarker)) {
+                    if (b2 == (0xff & JpegConstants.DNL_MARKER)) {
                         throw new ImageReadException("DNL not yet supported");
                     }
                     throw new ImageReadException("Invalid marker found "

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java Wed Nov 27 11:21:14 2013
@@ -155,7 +155,7 @@ public class ExifRewriter extends Binary
                     final byte[] segmentData) throws
             // ImageWriteException,
                     ImageReadException, IOException {
-                if (marker != JpegConstants.JPEG_APP1_Marker) {
+                if (marker != JpegConstants.JPEG_APP1_MARKER) {
                     pieces.add(new JFIFPieceSegment(marker, markerBytes,
                             markerLengthBytes, segmentData));
                 } else if (!startsWith(segmentData,
@@ -508,7 +508,7 @@ public class ExifRewriter extends Binary
             }
 
             if (!hasExif && newBytes != null) {
-                final byte[] markerBytes = toBytes((short) JpegConstants.JPEG_APP1_Marker);
+                final byte[] markerBytes = toBytes((short) JpegConstants.JPEG_APP1_MARKER);
                 if (newBytes.length > 0xffff) {
                     throw new ExifOverflowException(
                             "APP1 Segment is too long: " + newBytes.length);
@@ -519,10 +519,10 @@ public class ExifRewriter extends Binary
                 int index = 0;
                 final JFIFPieceSegment firstSegment = (JFIFPieceSegment) segments
                         .get(index);
-                if (firstSegment.marker == JpegConstants.JFIFMarker) {
+                if (firstSegment.marker == JpegConstants.JFIF_MARKER) {
                     index = 1;
                 }
-                segments.add(0, new JFIFPieceSegmentExif(JpegConstants.JPEG_APP1_Marker,
+                segments.add(0, new JFIFPieceSegmentExif(JpegConstants.JPEG_APP1_MARKER,
                         markerBytes, markerLengthBytes, newBytes));
             }
 
@@ -540,7 +540,7 @@ public class ExifRewriter extends Binary
                         continue;
                     }
 
-                    final byte[] markerBytes = toBytes((short) JpegConstants.JPEG_APP1_Marker);
+                    final byte[] markerBytes = toBytes((short) JpegConstants.JPEG_APP1_MARKER);
                     if (newBytes.length > 0xffff) {
                         throw new ExifOverflowException(
                                 "APP1 Segment is too long: " + newBytes.length);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java Wed Nov 27 11:21:14 2013
@@ -229,7 +229,7 @@ public class JpegIptcRewriter extends Jp
             newData = new PhotoshopApp13Data(newData.getRecords(), newBlocks);
 
             byte[] segmentBytes = new IptcParser().writePhotoshopApp13Segment(newData);
-            JFIFPieceSegment newSegment = new JFIFPieceSegment(JpegConstants.JPEG_APP13_Marker, segmentBytes);
+            JFIFPieceSegment newSegment = new JFIFPieceSegment(JpegConstants.JPEG_APP13_MARKER, segmentBytes);
 
             newPieces = insertAfterLastAppSegments(newPieces, Arrays.asList(newSegment));
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java Wed Nov 27 11:21:14 2013
@@ -41,15 +41,12 @@ public class App14Segment extends AppnSe
         ADOBE_PREFIX = adobe;
     }
 
-    public App14Segment(final int marker, final byte[] segmentData)
-            throws IOException {
-        this(marker, segmentData.length, new ByteArrayInputStream(
-                segmentData));
+    public App14Segment(int marker, byte[] segmentData) throws IOException {
+        this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
     }
     
-    public App14Segment(final int marker, final int marker_length, final InputStream is)
-            throws IOException {
-        super(marker, marker_length, is);
+    public App14Segment(int marker, int markerLength, InputStream is) throws IOException {
+        super(marker, markerLength, is);
     }
 
     public boolean isAdobeJpegSegment() {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java Wed Nov 27 11:21:14 2013
@@ -25,17 +25,17 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.formats.jpeg.JpegConstants;
 
 public class App2Segment extends AppnSegment implements Comparable<App2Segment> {
-    public final byte[] icc_bytes;
-    public final int cur_marker, num_markers;
+    public final byte[] iccBytes;
+    public final int curMarker, numMarkers;
 
     public App2Segment(final int marker, final byte[] segmentData)
             throws ImageReadException, IOException {
         this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
     }
 
-    public App2Segment(final int marker, int marker_length, final InputStream is2)
+    public App2Segment(final int marker, int markerLength, final InputStream is2)
             throws ImageReadException, IOException {
-        super(marker, marker_length, is2);
+        super(marker, markerLength, is2);
 
         if (BinaryFileParser.startsWith(getSegmentData(),
                 JpegConstants.ICC_PROFILE_LABEL)) {
@@ -44,19 +44,18 @@ public class App2Segment extends AppnSeg
             readAndVerifyBytes(is, JpegConstants.ICC_PROFILE_LABEL,
                     "Not a Valid App2 Segment: missing ICC Profile label");
 
-            cur_marker = readByte("cur_marker", is, "Not a valid App2 Marker");
-            num_markers = readByte("num_markers", is, "Not a valid App2 Marker");
+            curMarker = readByte("curMarker", is, "Not a valid App2 Marker");
+            numMarkers = readByte("numMarkers", is, "Not a valid App2 Marker");
 
-            marker_length -= JpegConstants.ICC_PROFILE_LABEL.size();
-            marker_length -= (1 + 1);
+            markerLength -= JpegConstants.ICC_PROFILE_LABEL.size();
+            markerLength -= (1 + 1);
 
-            icc_bytes = readBytes("App2 Data", is, marker_length,
-                    "Invalid App2 Segment: insufficient data");
+            iccBytes = readBytes("App2 Data", is, markerLength, "Invalid App2 Segment: insufficient data");
         } else {
             // debugByteArray("Unknown APP2 Segment Type", bytes);
-            cur_marker = -1;
-            num_markers = -1;
-            icc_bytes = null;
+            curMarker = -1;
+            numMarkers = -1;
+            iccBytes = null;
         }
     }
 
@@ -64,18 +63,18 @@ public class App2Segment extends AppnSeg
     public boolean equals(final Object obj) {
         if (obj instanceof App2Segment) {
             final App2Segment other = (App2Segment) obj;
-            return cur_marker == other.cur_marker;
+            return curMarker == other.curMarker;
         }
         return false;
     }
 
     @Override
     public int hashCode() {
-        return cur_marker;
+        return curMarker;
     }
 
     public int compareTo(final App2Segment other) {
-        return cur_marker - other.cur_marker;
+        return curMarker - other.curMarker;
     }
 
     // public String getDescription()

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java Wed Nov 27 11:21:14 2013
@@ -22,14 +22,13 @@ import java.io.InputStream;
 import org.apache.commons.imaging.formats.jpeg.JpegConstants;
 
 public class AppnSegment extends GenericSegment {
-    public AppnSegment(final int marker, final int marker_length, final InputStream is)
-            throws IOException {
-        super(marker, marker_length, is);
+
+    public AppnSegment(int marker, int markerLength, InputStream is) throws IOException {
+        super(marker, markerLength, is);
     }
 
     @Override
     public String getDescription() {
-        return "APPN (APP" + (marker - JpegConstants.JPEG_APP0_Marker)
-                + ") (" + getSegmentType() + ")";
+        return "APPN (APP" + (marker - JpegConstants.JPEG_APP0_MARKER) + ") (" + getSegmentType() + ")";
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java Wed Nov 27 11:21:14 2013
@@ -25,9 +25,8 @@ public class ComSegment extends GenericS
         super(marker, segmentData);
     }
 
-    public ComSegment(final int marker, final int marker_length, final InputStream is)
-            throws IOException {
-        super(marker, marker_length, is);
+    public ComSegment(int marker, int markerLength, InputStream is) throws IOException {
+        super(marker, markerLength, is);
     }
     
     /**

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java Wed Nov 27 11:21:14 2013
@@ -23,12 +23,10 @@ import java.io.PrintWriter;
 public abstract class GenericSegment extends Segment {
     protected final byte[] segmentData;
 
-    public GenericSegment(final int marker, final int marker_length, final InputStream is)
-            throws IOException {
-        super(marker, marker_length);
+    public GenericSegment(int marker, int markerLength, InputStream is) throws IOException {
+        super(marker, markerLength);
 
-        segmentData = readBytes("Segment Data", is, marker_length,
-                "Invalid Segment: insufficient data");
+        segmentData = readBytes("Segment Data", is, markerLength, "Invalid Segment: insufficient data");
     }
 
     public GenericSegment(final int marker, final byte[] bytes) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java Wed Nov 27 11:21:14 2013
@@ -44,9 +44,9 @@ public class JfifSegment extends Segment
         this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
     }
 
-    public JfifSegment(final int marker, final int marker_length, final InputStream is)
+    public JfifSegment(final int marker, final int markerLength, final InputStream is) 
             throws ImageReadException, IOException {
-        super(marker, marker_length);
+        super(marker, markerLength);
 
         final byte[] signature = readBytes(is, JpegConstants.JFIF0_SIGNATURE.size());
         if (!JpegConstants.JFIF0_SIGNATURE.equals(signature)

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java Wed Nov 27 11:21:14 2013
@@ -48,12 +48,12 @@ public class SofnSegment extends Segment
         this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
     }
 
-    public SofnSegment(final int marker, final int marker_length, final InputStream is)
+    public SofnSegment(final int marker, final int markerLength, final InputStream is)
             throws IOException {
-        super(marker, marker_length);
+        super(marker, markerLength);
 
         if (getDebug()) {
-            System.out.println("SOF0Segment marker_length: " + marker_length);
+            System.out.println("SOF0Segment marker_length: " + markerLength);
         }
 
         precision = readByte("Data_precision", is, "Not a Valid JPEG File");
@@ -102,7 +102,7 @@ public class SofnSegment extends Segment
 
     @Override
     public String getDescription() {
-        return "SOFN (SOF" + (marker - JpegConstants.SOF0Marker) + ") ("
+        return "SOFN (SOF" + (marker - JpegConstants.SOF0_MARKER) + ") ("
                 + getSegmentType() + ")";
     }