commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1417043 [15/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/ ...
Date Tue, 04 Dec 2012 17:24:32 GMT
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRational.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRational.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRational.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRational.java Tue Dec  4 17:23:16 2012
@@ -22,15 +22,15 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 public class TagInfoSRational extends TagInfo {
-    public TagInfoSRational(String name, int tag, int length, TiffDirectoryType directoryType) {
+    public TagInfoSRational(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
         super(name, tag, FIELD_TYPE_SRATIONAL, length, directoryType);
     }
 
-    public RationalNumber[] getValue(ByteOrder byteOrder, byte[] bytes) {
+    public RationalNumber[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
         return BinaryConversions.toRationals(bytes, byteOrder);
     }
     
-    public byte[] encodeValue(ByteOrder byteOrder, RationalNumber... values) {
+    public byte[] encodeValue(final ByteOrder byteOrder, final RationalNumber... values) {
         return BinaryConversions.toBytes(values, byteOrder);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java Tue Dec  4 17:23:16 2012
@@ -22,15 +22,15 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 public class TagInfoSShort extends TagInfo {
-    public TagInfoSShort(String name, int tag, int length, TiffDirectoryType directoryType) {
+    public TagInfoSShort(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
         super(name, tag, FIELD_TYPE_SSHORT, length, directoryType);
     }
     
-    public short[] getValue(ByteOrder byteOrder, byte[] bytes) {
+    public short[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
         return BinaryConversions.toShorts(bytes, byteOrder);
     }
     
-    public byte[] encodeValue(ByteOrder byteOrder, short... values) throws ImageWriteException {
+    public byte[] encodeValue(final ByteOrder byteOrder, final short... values) throws ImageWriteException {
         return BinaryConversions.toBytes(values, byteOrder);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java Tue Dec  4 17:23:16 2012
@@ -21,15 +21,15 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 public class TagInfoShort extends TagInfo {
-    public TagInfoShort(String name, int tag, int length, TiffDirectoryType directoryType) {
+    public TagInfoShort(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
         super(name, tag, FIELD_TYPE_SHORT, length, directoryType);
     }
     
-    public short[] getValue(ByteOrder byteOrder, byte[] bytes) {
+    public short[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
         return BinaryConversions.toShorts(bytes, byteOrder);
     }
 
-    public byte[] encodeValue(ByteOrder byteOrder, short... values) {
+    public byte[] encodeValue(final ByteOrder byteOrder, final short... values) {
         return BinaryConversions.toBytes(values, byteOrder);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLong.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLong.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLong.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLong.java Tue Dec  4 17:23:16 2012
@@ -21,19 +21,19 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 public class TagInfoShortOrLong extends TagInfo {
-    public TagInfoShortOrLong(String name, int tag, int length, TiffDirectoryType directoryType) {
+    public TagInfoShortOrLong(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
         super(name, tag, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, length, directoryType, false);
     }
     
-    public TagInfoShortOrLong(String name, int tag, int length, TiffDirectoryType directoryType, boolean isOffset) {
+    public TagInfoShortOrLong(final String name, final int tag, final int length, final TiffDirectoryType directoryType, final boolean isOffset) {
         super(name, tag, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, length, directoryType, isOffset);
     }
     
-    public byte[] encodeValue(ByteOrder byteOrder, short... values) {
+    public byte[] encodeValue(final ByteOrder byteOrder, final short... values) {
         return BinaryConversions.toBytes(values, byteOrder);
     }
     
-    public byte[] encodeValue(ByteOrder byteOrder, int... values) {
+    public byte[] encodeValue(final ByteOrder byteOrder, final int... values) {
         return BinaryConversions.toBytes(values, byteOrder);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLongOrRational.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLongOrRational.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLongOrRational.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLongOrRational.java Tue Dec  4 17:23:16 2012
@@ -22,19 +22,19 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 public class TagInfoShortOrLongOrRational extends TagInfo {
-    public TagInfoShortOrLongOrRational(String name, int tag, int length, TiffDirectoryType directoryType) {
+    public TagInfoShortOrLongOrRational(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
         super(name, tag, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, length, directoryType);
     }
     
-    public byte[] encodeValue(ByteOrder byteOrder, short... values) {
+    public byte[] encodeValue(final ByteOrder byteOrder, final short... values) {
         return BinaryConversions.toBytes(values, byteOrder);
     }
     
-    public byte[] encodeValue(ByteOrder byteOrder, int... values) {
+    public byte[] encodeValue(final ByteOrder byteOrder, final int... values) {
         return BinaryConversions.toBytes(values, byteOrder);
     }
     
-    public byte[] encodeValue(ByteOrder byteOrder, RationalNumber... values) {
+    public byte[] encodeValue(final ByteOrder byteOrder, final RationalNumber... values) {
         return BinaryConversions.toBytes(values, byteOrder);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrRational.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrRational.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrRational.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrRational.java Tue Dec  4 17:23:16 2012
@@ -22,15 +22,15 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 public class TagInfoShortOrRational extends TagInfo {
-    public TagInfoShortOrRational(String name, int tag, int length, TiffDirectoryType directoryType) {
+    public TagInfoShortOrRational(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
         super(name, tag, FIELD_TYPE_DESCRIPTION_SHORT_OR_RATIONAL, length, directoryType, false);
     }
     
-    public byte[] encodeValue(ByteOrder byteOrder, short... values) {
+    public byte[] encodeValue(final ByteOrder byteOrder, final short... values) {
         return BinaryConversions.toBytes(values, byteOrder);
     }
 
-    public byte[] encodeValue(ByteOrder byteOrder, RationalNumber... values) {
+    public byte[] encodeValue(final ByteOrder byteOrder, final RationalNumber... values) {
         return BinaryConversions.toBytes(values, byteOrder);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java Tue Dec  4 17:23:16 2012
@@ -21,7 +21,7 @@ import java.util.Arrays;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 public class TagInfoUndefined extends TagInfoByte {
-    public TagInfoUndefined(String name, int tag, int length, TiffDirectoryType directoryType) {
+    public TagInfoUndefined(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
         super(name, tag, Arrays.asList(FIELD_TYPE_UNDEFINED), length, directoryType);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java Tue Dec  4 17:23:16 2012
@@ -21,7 +21,7 @@ import java.util.Arrays;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 public final class TagInfoUnknown extends TagInfoByte {
-    public TagInfoUnknown(String name, int tag, int length, TiffDirectoryType exifDirectory) {
+    public TagInfoUnknown(final String name, final int tag, final int length, final TiffDirectoryType exifDirectory) {
         super(name, tag, Arrays.asList(FIELD_TYPE_UNKNOWN), length, exifDirectory);
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java Tue Dec  4 17:23:16 2012
@@ -32,35 +32,35 @@ import org.apache.commons.imaging.util.D
  * - here we deal with this.
  */
 public class TagInfoXpString extends TagInfo {
-    public TagInfoXpString(String name, int tag, int length,
-            TiffDirectoryType directoryType) {
+    public TagInfoXpString(final String name, final int tag, final int length,
+            final TiffDirectoryType directoryType) {
         super(name, tag, Arrays.asList(FIELD_TYPE_UNDEFINED), length,
                 directoryType);
     }
 
     @Override
-    public byte[] encodeValue(FieldType fieldType, Object value, ByteOrder byteOrder)
+    public byte[] encodeValue(final FieldType fieldType, final Object value, final ByteOrder byteOrder)
             throws ImageWriteException {
         if (!(value instanceof String)) {
             throw new ImageWriteException("Text value not String: " + value
                     + " (" + Debug.getType(value) + ")");
         }
-        String s = (String) value;
+        final String s = (String) value;
         try {
             return s.getBytes("UTF-16LE");
-        } catch (UnsupportedEncodingException cannotHappen) {
+        } catch (final UnsupportedEncodingException cannotHappen) {
             return null;
         }
     }
 
     @Override
-    public String getValue(TiffField entry) throws ImageReadException {
+    public String getValue(final TiffField entry) throws ImageReadException {
         if (entry.type != FIELD_TYPE_BYTE.type) {
             throw new ImageReadException("Text field not encoded as bytes.");
         }
         try {
             return new String(entry.getByteArrayValue(), "UTF-16LE");
-        } catch (UnsupportedEncodingException cannotHappen) {
+        } catch (final UnsupportedEncodingException cannotHappen) {
             return null;
         }
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/ImageDataOffsets.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/ImageDataOffsets.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/ImageDataOffsets.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/ImageDataOffsets.java Tue Dec  4 17:23:16 2012
@@ -31,7 +31,7 @@ class ImageDataOffsets {
 
         outputItems = new TiffOutputItem[imageData.length];
         for (int i = 0; i < imageData.length; i++) {
-            TiffOutputItem item = new TiffOutputItem.Value("TIFF image data",
+            final TiffOutputItem item = new TiffOutputItem.Value("TIFF image data",
                     imageData[i].data);
             outputItems[i] = item;
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java Tue Dec  4 17:23:16 2012
@@ -48,20 +48,20 @@ public abstract class TiffImageWriterBas
         this.byteOrder = DEFAULT_TIFF_BYTE_ORDER;
     }
 
-    public TiffImageWriterBase(ByteOrder byteOrder) {
+    public TiffImageWriterBase(final ByteOrder byteOrder) {
         this.byteOrder = byteOrder;
     }
 
-    protected final static int imageDataPaddingLength(int dataLength) {
+    protected final static int imageDataPaddingLength(final int dataLength) {
         return (4 - (dataLength % 4)) % 4;
     }
 
     public abstract void write(OutputStream os, TiffOutputSet outputSet)
             throws IOException, ImageWriteException;
 
-    protected TiffOutputSummary validateDirectories(TiffOutputSet outputSet)
+    protected TiffOutputSummary validateDirectories(final TiffOutputSet outputSet)
             throws ImageWriteException {
-        List<TiffOutputDirectory> directories = outputSet.getDirectories();
+        final List<TiffOutputDirectory> directories = outputSet.getDirectories();
 
         if (1 > directories.size()) { 
             throw new ImageWriteException("No directories.");
@@ -74,10 +74,10 @@ public abstract class TiffImageWriterBas
         TiffOutputField gpsDirectoryOffsetField = null;
         TiffOutputField interoperabilityDirectoryOffsetField = null;
 
-        List<Integer> directoryIndices = new ArrayList<Integer>();
-        Map<Integer, TiffOutputDirectory> directoryTypeMap = new HashMap<Integer, TiffOutputDirectory>();
+        final List<Integer> directoryIndices = new ArrayList<Integer>();
+        final Map<Integer, TiffOutputDirectory> directoryTypeMap = new HashMap<Integer, TiffOutputDirectory>();
         for (int i = 0; i < directories.size(); i++) {
-            TiffOutputDirectory directory = directories.get(i);
+            final TiffOutputDirectory directory = directories.get(i);
             final int dirType = directory.type;
             directoryTypeMap.put(dirType, directory);
             // Debug.debug("validating dirType", dirType + " ("
@@ -122,10 +122,10 @@ public abstract class TiffImageWriterBas
                 // dirMap.put(arg0, arg1)
             }
 
-            HashSet<Integer> fieldTags = new HashSet<Integer>();
-            List<TiffOutputField> fields = directory.getFields();
+            final HashSet<Integer> fieldTags = new HashSet<Integer>();
+            final List<TiffOutputField> fields = directory.getFields();
             for (int j = 0; j < fields.size(); j++) {
-                TiffOutputField field = fields.get(j);
+                final TiffOutputField field = fields.get(j);
 
                 if (fieldTags.contains(field.tag)) {
                     throw new ImageWriteException("Tag ("
@@ -167,24 +167,24 @@ public abstract class TiffImageWriterBas
 
         TiffOutputDirectory previousDirectory = null;
         for (int i = 0; i < directoryIndices.size(); i++) {
-            Integer index = directoryIndices.get(i);
+            final Integer index = directoryIndices.get(i);
             if (index.intValue() != i) {
                 throw new ImageWriteException("Missing directory: " + i + ".");
             }
 
             // set up chain of directory references for "normal" directories.
-            TiffOutputDirectory directory = directoryTypeMap.get(index);
+            final TiffOutputDirectory directory = directoryTypeMap.get(index);
             if (null != previousDirectory) {
                 previousDirectory.setNextDirectory(directory);
             }
             previousDirectory = directory;
         }
 
-        TiffOutputDirectory rootDirectory = directoryTypeMap
+        final TiffOutputDirectory rootDirectory = directoryTypeMap
                 .get(DIRECTORY_TYPE_ROOT);
 
         // prepare results
-        TiffOutputSummary result = new TiffOutputSummary(byteOrder,
+        final TiffOutputSummary result = new TiffOutputSummary(byteOrder,
                 rootDirectory, directoryTypeMap);
 
         if (interoperabilityDirectory == null
@@ -243,7 +243,7 @@ public abstract class TiffImageWriterBas
         // Debug.debug();
     }
 
-    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 = new HashMap<String,Object>(params);
@@ -270,12 +270,12 @@ public abstract class TiffImageWriterBas
             pixelDensity = PixelDensity.createFromPixelsPerInch(72, 72);
         }
 
-        int width = src.getWidth();
-        int height = src.getHeight();
+        final int width = src.getWidth();
+        final int height = src.getHeight();
 
         int compression = TIFF_COMPRESSION_LZW; // LZW is default
         if (params.containsKey(PARAM_KEY_COMPRESSION)) {
-            Object value = params.get(PARAM_KEY_COMPRESSION);
+            final Object value = params.get(PARAM_KEY_COMPRESSION);
             if (value != null) {
                 if (!(value instanceof Number)) {
                     throw new ImageWriteException(
@@ -285,11 +285,11 @@ public abstract class TiffImageWriterBas
             }
             params.remove(PARAM_KEY_COMPRESSION);
         }
-        HashMap<String,Object> rawParams = new HashMap<String,Object>(params);
+        final HashMap<String,Object> rawParams = new HashMap<String,Object>(params);
         params.remove(PARAM_KEY_T4_OPTIONS);
         params.remove(PARAM_KEY_T6_OPTIONS);
         if (params.size() > 0) {
-            Object firstKey = params.keySet().iterator().next();
+            final Object firstKey = params.keySet().iterator().next();
             throw new ImageWriteException("Unknown parameter: " + firstKey);
         }
 
@@ -311,7 +311,7 @@ public abstract class TiffImageWriterBas
         int rowsPerStrip = 64000 / (width * bitsPerSample * samplesPerPixel); // TODO:
         rowsPerStrip = Math.max(1, rowsPerStrip); // must have at least one.
 
-        byte strips[][] = getStrips(src, samplesPerPixel, bitsPerSample,
+        final byte strips[][] = getStrips(src, samplesPerPixel, bitsPerSample,
                 rowsPerStrip);
 
         // System.out.println("width: " + width);
@@ -328,18 +328,18 @@ public abstract class TiffImageWriterBas
                         strips[i], width, strips[i].length / ((width + 7) / 8));
             }
         } else if (compression == TIFF_COMPRESSION_CCITT_GROUP_3) {
-            Integer t4Parameter = (Integer) rawParams.get(PARAM_KEY_T4_OPTIONS);
+            final Integer t4Parameter = (Integer) rawParams.get(PARAM_KEY_T4_OPTIONS);
             if (t4Parameter != null) {
                 t4Options = t4Parameter.intValue();
             }
             t4Options &= 0x7;
-            boolean is2D = (t4Options & 1) != 0;
-            boolean usesUncompressedMode = (t4Options & 2) != 0;
+            final boolean is2D = (t4Options & 1) != 0;
+            final boolean usesUncompressedMode = (t4Options & 2) != 0;
             if (usesUncompressedMode) {
                 throw new ImageWriteException(
                         "T.4 compression with the uncompressed mode extension is not yet supported");
             }
-            boolean hasFillBitsBeforeEOL = (t4Options & 4) != 0;
+            final boolean hasFillBitsBeforeEOL = (t4Options & 4) != 0;
             for (int i = 0; i < strips.length; i++) {
                 if (is2D) {
                     strips[i] = T4AndT6Compression.compressT4_2D(strips[i],
@@ -352,12 +352,12 @@ public abstract class TiffImageWriterBas
                 }
             }
         } else if (compression == TIFF_COMPRESSION_CCITT_GROUP_4) {
-            Integer t6Parameter = (Integer) rawParams.get(PARAM_KEY_T6_OPTIONS);
+            final Integer t6Parameter = (Integer) rawParams.get(PARAM_KEY_T6_OPTIONS);
             if (t6Parameter != null) {
                 t6Options = t6Parameter.intValue();
             }
             t6Options &= 0x4;
-            boolean usesUncompressedMode = (t6Options & TIFF_FLAG_T6_OPTIONS_UNCOMPRESSED_MODE) != 0;
+            final boolean usesUncompressedMode = (t6Options & TIFF_FLAG_T6_OPTIONS_UNCOMPRESSED_MODE) != 0;
             if (usesUncompressedMode) {
                 throw new ImageWriteException(
                         "T.6 compression with the uncompressed mode extension is not yet supported");
@@ -372,13 +372,13 @@ public abstract class TiffImageWriterBas
             }
         } else if (compression == TIFF_COMPRESSION_LZW) {
             for (int i = 0; i < strips.length; i++) {
-                byte uncompressed[] = strips[i];
+                final byte uncompressed[] = strips[i];
 
-                int LZW_MINIMUM_CODE_SIZE = 8;
+                final int LZW_MINIMUM_CODE_SIZE = 8;
 
-                MyLzwCompressor compressor = new MyLzwCompressor(
+                final MyLzwCompressor compressor = new MyLzwCompressor(
                         LZW_MINIMUM_CODE_SIZE, ByteOrder.MOTOROLA, true);
-                byte compressed[] = compressor.compress(uncompressed);
+                final byte compressed[] = compressor.compress(uncompressed);
 
                 strips[i] = compressed;
             }
@@ -389,14 +389,14 @@ public abstract class TiffImageWriterBas
                     "Invalid compression parameter (Only CCITT 1D/Group 3/Group 4, LZW, Packbits and uncompressed supported).");
         }
 
-        TiffElement.DataElement imageData[] = new TiffElement.DataElement[strips.length];
+        final TiffElement.DataElement imageData[] = new TiffElement.DataElement[strips.length];
         for (int i = 0; i < strips.length; i++) {
             imageData[i] = new TiffImageData.Data(0, strips[i].length,
                     strips[i]);
         }
 
-        TiffOutputSet outputSet = new TiffOutputSet(byteOrder);
-        TiffOutputDirectory directory = outputSet.addRootDirectory();
+        final TiffOutputSet outputSet = new TiffOutputSet(byteOrder);
+        final TiffOutputDirectory directory = outputSet.addRootDirectory();
 
         // WriteField stripOffsetsField;
 
@@ -470,13 +470,13 @@ public abstract class TiffImageWriterBas
             }
 
             if (null != xmpXml) {
-                byte xmpXmlBytes[] = xmpXml.getBytes("utf-8");
+                final byte xmpXmlBytes[] = xmpXml.getBytes("utf-8");
                 directory.add(TiffTagConstants.TIFF_TAG_XMP, xmpXmlBytes);
             }
 
         }
 
-        TiffImageData tiffImageData = new TiffImageData.Strips(imageData,
+        final TiffImageData tiffImageData = new TiffImageData.Strips(imageData,
                 rowsPerStrip);
         directory.setTiffImageData(tiffImageData);
 
@@ -487,20 +487,20 @@ public abstract class TiffImageWriterBas
         write(os, outputSet);
     }
 
-    private void combineUserExifIntoFinalExif(TiffOutputSet userExif,
-            TiffOutputSet outputSet) throws ImageWriteException {
-        List<TiffOutputDirectory> outputDirectories = outputSet
+    private void combineUserExifIntoFinalExif(final TiffOutputSet userExif,
+            final TiffOutputSet outputSet) throws ImageWriteException {
+        final List<TiffOutputDirectory> outputDirectories = outputSet
                 .getDirectories();
         Collections.sort(outputDirectories, TiffOutputDirectory.COMPARATOR);
-        for (TiffOutputDirectory userDirectory : userExif.getDirectories()) {
-            int location = Collections.binarySearch(outputDirectories,
+        for (final TiffOutputDirectory userDirectory : userExif.getDirectories()) {
+            final int location = Collections.binarySearch(outputDirectories,
                     userDirectory, TiffOutputDirectory.COMPARATOR);
             if (location < 0) {
                 outputSet.addDirectory(userDirectory);
             } else {
-                TiffOutputDirectory outputDirectory = outputDirectories
+                final TiffOutputDirectory outputDirectory = outputDirectories
                         .get(location);
-                for (TiffOutputField userField : userDirectory.getFields()) {
+                for (final TiffOutputField userField : userDirectory.getFields()) {
                     if (outputDirectory.findField(userField.tagInfo) == null) {
                         outputDirectory.add(userField);
                     }
@@ -509,12 +509,12 @@ public abstract class TiffImageWriterBas
         }
     }
 
-    private byte[][] getStrips(BufferedImage src, int samplesPerPixel,
-            int bitsPerSample, int rowsPerStrip) {
-        int width = src.getWidth();
-        int height = src.getHeight();
+    private byte[][] getStrips(final BufferedImage src, final int samplesPerPixel,
+            final int bitsPerSample, final int rowsPerStrip) {
+        final int width = src.getWidth();
+        final int height = src.getHeight();
 
-        int stripCount = (height + rowsPerStrip - 1) / rowsPerStrip;
+        final int stripCount = (height + rowsPerStrip - 1) / rowsPerStrip;
 
         byte result[][] = null;
         { // Write Strips
@@ -523,27 +523,27 @@ public abstract class TiffImageWriterBas
             int remaining_rows = height;
 
             for (int i = 0; i < stripCount; i++) {
-                int rowsInStrip = Math.min(rowsPerStrip, remaining_rows);
+                final int rowsInStrip = Math.min(rowsPerStrip, remaining_rows);
                 remaining_rows -= rowsInStrip;
 
-                int bitsInRow = bitsPerSample * samplesPerPixel * width;
-                int bytesPerRow = (bitsInRow + 7) / 8;
-                int bytesInStrip = rowsInStrip * bytesPerRow;
+                final int bitsInRow = bitsPerSample * samplesPerPixel * width;
+                final int bytesPerRow = (bitsInRow + 7) / 8;
+                final int bytesInStrip = rowsInStrip * bytesPerRow;
 
-                byte uncompressed[] = new byte[bytesInStrip];
+                final byte uncompressed[] = new byte[bytesInStrip];
 
                 int counter = 0;
                 int y = i * rowsPerStrip;
-                int stop = i * rowsPerStrip + rowsPerStrip;
+                final int stop = i * rowsPerStrip + rowsPerStrip;
 
                 for (; (y < height) && (y < stop); y++) {
                     int bitCache = 0;
                     int bitsInCache = 0;
                     for (int x = 0; x < width; x++) {
-                        int rgb = src.getRGB(x, y);
-                        int red = 0xff & (rgb >> 16);
-                        int green = 0xff & (rgb >> 8);
-                        int blue = 0xff & (rgb >> 0);
+                        final int rgb = src.getRGB(x, y);
+                        final int red = 0xff & (rgb >> 16);
+                        final int green = 0xff & (rgb >> 8);
+                        final int blue = 0xff & (rgb >> 0);
 
                         if (bitsPerSample == 1) {
                             int sample = (red + green + blue) / 3;
@@ -580,15 +580,15 @@ public abstract class TiffImageWriterBas
         return result;
     }
 
-    protected void writeImageFileHeader(BinaryOutputStream bos)
+    protected void writeImageFileHeader(final BinaryOutputStream bos)
             throws IOException {
-        int offsetToFirstIFD = TIFF_HEADER_SIZE;
+        final int offsetToFirstIFD = TIFF_HEADER_SIZE;
 
         writeImageFileHeader(bos, offsetToFirstIFD);
     }
 
-    protected void writeImageFileHeader(BinaryOutputStream bos,
-            int offsetToFirstIFD) throws IOException {
+    protected void writeImageFileHeader(final BinaryOutputStream bos,
+            final int offsetToFirstIFD) throws IOException {
         if (byteOrder == ByteOrder.INTEL) {
             bos.write('I');
             bos.write('I');

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java Tue Dec  4 17:23:16 2012
@@ -46,25 +46,25 @@ import org.apache.commons.imaging.util.D
 public class TiffImageWriterLossless extends TiffImageWriterBase {
     private final byte exifBytes[];
 
-    public TiffImageWriterLossless(byte exifBytes[]) {
+    public TiffImageWriterLossless(final byte exifBytes[]) {
         this.exifBytes = exifBytes;
     }
 
-    public TiffImageWriterLossless(ByteOrder byteOrder, byte exifBytes[]) {
+    public TiffImageWriterLossless(final ByteOrder byteOrder, final byte exifBytes[]) {
         super(byteOrder);
         this.exifBytes = exifBytes;
     }
 
-    private void dumpElements(ByteSource byteSource, List<TiffElement> elements)
+    private void dumpElements(final ByteSource byteSource, final List<TiffElement> elements)
             throws IOException {
         int last = TIFF_HEADER_SIZE;
         for (int i = 0; i < elements.size(); i++) {
-            TiffElement element = elements.get(i);
+            final TiffElement element = elements.get(i);
             if (element.offset > last) {
                 final int SLICE_SIZE = 32;
-                int gepLength = element.offset - last;
+                final int gepLength = element.offset - last;
                 Debug.debug("gap of " + gepLength + " bytes.");
-                byte bytes[] = byteSource.getBlock(last, gepLength);
+                final byte bytes[] = byteSource.getBlock(last, gepLength);
                 if (bytes.length > 2 * SLICE_SIZE) {
                     Debug.debug("\t" + "head",
                             BinaryFileFunctions.head(bytes, SLICE_SIZE));
@@ -79,7 +79,7 @@ public class TiffImageWriterLossless ext
                     + " (" + element.offset + " + " + element.length + " = "
                     + (element.offset + element.length) + ")");
             if (element instanceof TiffDirectory) {
-                TiffDirectory dir = (TiffDirectory) element;
+                final TiffDirectory dir = (TiffDirectory) element;
                 Debug.debug("\t" + "next Directory Offset: "
                         + dir.nextDirectoryOffset);
             }
@@ -91,23 +91,23 @@ public class TiffImageWriterLossless ext
     private List<TiffElement> analyzeOldTiff() throws ImageWriteException,
             IOException {
         try {
-            ByteSource byteSource = new ByteSourceArray(exifBytes);
-            Map<String,Object> params = null;
-            FormatCompliance formatCompliance = FormatCompliance.getDefault();
-            TiffContents contents = new TiffReader(false).readContents(
+            final ByteSource byteSource = new ByteSourceArray(exifBytes);
+            final Map<String,Object> params = null;
+            final FormatCompliance formatCompliance = FormatCompliance.getDefault();
+            final TiffContents contents = new TiffReader(false).readContents(
                     byteSource, params, formatCompliance);
 
-            List<TiffElement> elements = new ArrayList<TiffElement>();
+            final List<TiffElement> elements = new ArrayList<TiffElement>();
             // result.add(contents.header); // ?
 
-            List<TiffDirectory> directories = contents.directories;
+            final List<TiffDirectory> directories = contents.directories;
             for (int d = 0; d < directories.size(); d++) {
-                TiffDirectory directory = directories.get(d);
+                final TiffDirectory directory = directories.get(d);
                 elements.add(directory);
 
-                List<TiffField> fields = directory.getDirectoryEntrys();
+                final List<TiffField> fields = directory.getDirectoryEntrys();
                 for (int f = 0; f < fields.size(); f++) {
-                    TiffField field = fields.get(f);
+                    final TiffField field = fields.get(f);
                     if (field.tag == ExifTagConstants.EXIF_TAG_MAKER_NOTE.tag) {
                         // Some maker notes reference values stored
                         // inside the maker note itself
@@ -121,22 +121,22 @@ public class TiffImageWriterLossless ext
                         // the old copy's values. Happy days.
                         continue;
                     }
-                    TiffElement oversizeValue = field.getOversizeValueElement();
+                    final TiffElement oversizeValue = field.getOversizeValueElement();
                     if (oversizeValue != null) {
                         elements.add(oversizeValue);
                     }
                 }
 
-                JpegImageData jpegImageData = directory.getJpegImageData();
+                final JpegImageData jpegImageData = directory.getJpegImageData();
                 if (jpegImageData != null) {
                     elements.add(jpegImageData);
                 }
 
-                TiffImageData tiffImageData = directory.getTiffImageData();
+                final TiffImageData tiffImageData = directory.getTiffImageData();
                 if (tiffImageData != null) {
-                    TiffElement.DataElement data[] = tiffImageData
+                    final TiffElement.DataElement data[] = tiffImageData
                             .getImageData();
-                    for (DataElement element : data) {
+                    for (final DataElement element : data) {
                         elements.add(element);
                     }
                 }
@@ -146,15 +146,15 @@ public class TiffImageWriterLossless ext
 
             // dumpElements(byteSource, elements);
 
-            List<TiffElement> result = new ArrayList<TiffElement>();
+            final List<TiffElement> result = new ArrayList<TiffElement>();
             {
                 final int TOLERANCE = 3;
                 // int last = TIFF_HEADER_SIZE;
                 TiffElement start = null;
                 int index = -1;
                 for (int i = 0; i < elements.size(); i++) {
-                    TiffElement element = elements.get(i);
-                    int lastElementByte = element.offset + element.length;
+                    final TiffElement element = elements.get(i);
+                    final int lastElementByte = element.offset + element.length;
                     if (start == null) {
                         start = element;
                         index = lastElementByte;
@@ -176,20 +176,20 @@ public class TiffImageWriterLossless ext
             // dumpElements(byteSource, result);
 
             return result;
-        } catch (ImageReadException e) {
+        } catch (final ImageReadException e) {
             throw new ImageWriteException(e.getMessage(), e);
         }
     }
 
     @Override
-    public void write(OutputStream os, TiffOutputSet outputSet)
+    public void write(final OutputStream os, final TiffOutputSet outputSet)
             throws IOException, ImageWriteException {
-        List<TiffElement> analysis = analyzeOldTiff();
-        int oldLength = exifBytes.length;
+        final List<TiffElement> analysis = analyzeOldTiff();
+        final int oldLength = exifBytes.length;
         if (analysis.size() < 1) {
             throw new ImageWriteException("Couldn't analyze old tiff data.");
         } else if (analysis.size() == 1) {
-            TiffElement onlyElement = analysis.get(0);
+            final TiffElement onlyElement = analysis.get(0);
             // Debug.debug("onlyElement", onlyElement.getElementDescription());
             if (onlyElement.offset == TIFF_HEADER_SIZE
                     && onlyElement.offset + onlyElement.length
@@ -205,12 +205,12 @@ public class TiffImageWriterLossless ext
 
         // List directories = outputSet.getDirectories();
 
-        TiffOutputSummary outputSummary = validateDirectories(outputSet);
+        final TiffOutputSummary outputSummary = validateDirectories(outputSet);
 
-        List<TiffOutputItem> outputItems = outputSet
+        final List<TiffOutputItem> outputItems = outputSet
                 .getOutputItems(outputSummary);
 
-        int outputLength = updateOffsetsStep(analysis, outputItems);
+        final int outputLength = updateOffsetsStep(analysis, outputItems);
         // Debug.debug("outputLength", outputLength);
 
         outputSummary.updateOffsets(byteOrder);
@@ -220,24 +220,24 @@ public class TiffImageWriterLossless ext
     }
 
     private static final Comparator<TiffElement> ELEMENT_SIZE_COMPARATOR = new Comparator<TiffElement>() {
-        public int compare(TiffElement e1, TiffElement e2) {
+        public int compare(final TiffElement e1, final TiffElement e2) {
             return e1.length - e2.length;
         }
     };
 
     private static final Comparator<TiffOutputItem> ITEM_SIZE_COMPARATOR = new Comparator<TiffOutputItem>() {
-        public int compare(TiffOutputItem e1, TiffOutputItem e2) {
+        public int compare(final TiffOutputItem e1, final TiffOutputItem e2) {
             return e1.getItemLength() - e2.getItemLength();
         }
     };
 
-    private int updateOffsetsStep(List<TiffElement> analysis,
-            List<TiffOutputItem> outputItems) {
+    private int updateOffsetsStep(final List<TiffElement> analysis,
+            final List<TiffOutputItem> outputItems) {
         // items we cannot fit into a gap, we shall append to tail.
         int overflowIndex = exifBytes.length;
 
         // make copy.
-        List<TiffElement> unusedElements = new ArrayList<TiffElement>(analysis);
+        final List<TiffElement> unusedElements = new ArrayList<TiffElement>(analysis);
 
         // should already be in order of offset, but make sure.
         Collections.sort(unusedElements, TiffElement.COMPARATOR);
@@ -245,8 +245,8 @@ public class TiffImageWriterLossless ext
         // any items that represent a gap at the end of the exif segment, can be
         // discarded.
         while (unusedElements.size() > 0) {
-            TiffElement element = unusedElements.get(0);
-            int elementEnd = element.offset + element.length;
+            final TiffElement element = unusedElements.get(0);
+            final int elementEnd = element.offset + element.length;
             if (elementEnd == overflowIndex) {
                 // discarding a tail element. should only happen once.
                 overflowIndex -= element.length;
@@ -263,15 +263,15 @@ public class TiffImageWriterLossless ext
         // dumpElements(unusedElements);
 
         // make copy.
-        List<TiffOutputItem> unplacedItems = new ArrayList<TiffOutputItem>(
+        final List<TiffOutputItem> unplacedItems = new ArrayList<TiffOutputItem>(
                 outputItems);
         Collections.sort(unplacedItems, ITEM_SIZE_COMPARATOR);
         Collections.reverse(unplacedItems);
 
         while (unplacedItems.size() > 0) {
             // pop off largest unplaced item.
-            TiffOutputItem outputItem = unplacedItems.remove(0);
-            int outputItemLength = outputItem.getItemLength();
+            final TiffOutputItem outputItem = unplacedItems.remove(0);
+            final int outputItemLength = outputItem.getItemLength();
             // Debug.debug("largest unplaced item: "
             // + outputItem.getItemDescription() + " (" + outputItemLength
             // + ")");
@@ -280,7 +280,7 @@ public class TiffImageWriterLossless ext
             // item.
             TiffElement bestFit = null;
             for (int i = 0; i < unusedElements.size(); i++) {
-                TiffElement element = unusedElements.get(i);
+                final TiffElement element = unusedElements.get(i);
                 if (element.length >= outputItemLength) {
                     bestFit = element;
                 } else {
@@ -297,8 +297,8 @@ public class TiffImageWriterLossless ext
 
                 if (bestFit.length > outputItemLength) {
                     // not a perfect fit.
-                    int excessOffset = bestFit.offset + outputItemLength;
-                    int excessLength = bestFit.length - outputItemLength;
+                    final int excessOffset = bestFit.offset + outputItemLength;
+                    final int excessLength = bestFit.length - outputItemLength;
                     unusedElements.add(new TiffElement.Stub(excessOffset,
                             excessLength));
                     // make sure the new element is in the correct order.
@@ -339,7 +339,7 @@ public class TiffImageWriterLossless ext
         }
 
         @Override
-        public void write(int b) throws IOException {
+        public void write(final int b) throws IOException {
             if (index >= buffer.length) {
                 throw new IOException("Buffer overflow.");
             }
@@ -348,7 +348,7 @@ public class TiffImageWriterLossless ext
         }
 
         @Override
-        public void write(byte b[], int off, int len) throws IOException {
+        public void write(final byte b[], final int off, final int len) throws IOException {
             if (index + len > buffer.length) {
                 throw new IOException("Buffer overflow.");
             }
@@ -357,12 +357,12 @@ public class TiffImageWriterLossless ext
         }
     }
 
-    private void writeStep(OutputStream os, TiffOutputSet outputSet,
-            List<TiffElement> analysis, List<TiffOutputItem> outputItems,
-            int outputLength) throws IOException, ImageWriteException {
-        TiffOutputDirectory rootDirectory = outputSet.getRootDirectory();
+    private void writeStep(final OutputStream os, final TiffOutputSet outputSet,
+            final List<TiffElement> analysis, final List<TiffOutputItem> outputItems,
+            final int outputLength) throws IOException, ImageWriteException {
+        final TiffOutputDirectory rootDirectory = outputSet.getRootDirectory();
 
-        byte output[] = new byte[outputLength];
+        final byte output[] = new byte[outputLength];
 
         // copy old data (including maker notes, etc.)
         System.arraycopy(exifBytes, 0, output, 0,
@@ -372,17 +372,17 @@ public class TiffImageWriterLossless ext
         // - TIFF_HEADER_SIZE);
 
         {
-            BufferOutputStream tos = new BufferOutputStream(output, 0);
-            BinaryOutputStream bos = new BinaryOutputStream(tos, byteOrder);
+            final BufferOutputStream tos = new BufferOutputStream(output, 0);
+            final BinaryOutputStream bos = new BinaryOutputStream(tos, byteOrder);
             writeImageFileHeader(bos, rootDirectory.getOffset());
         }
 
         // zero out the parsed pieces of old exif segment, in case we don't
         // overwrite them.
         for (int i = 0; i < analysis.size(); i++) {
-            TiffElement element = analysis.get(i);
+            final TiffElement element = analysis.get(i);
             for (int j = 0; j < element.length; j++) {
-                int index = element.offset + j;
+                final int index = element.offset + j;
                 if (index < output.length) {
                     output[index] = 0;
                 }
@@ -391,11 +391,11 @@ public class TiffImageWriterLossless ext
 
         // write in the new items
         for (int i = 0; i < outputItems.size(); i++) {
-            TiffOutputItem outputItem = outputItems.get(i);
+            final TiffOutputItem outputItem = outputItems.get(i);
 
-            BufferOutputStream tos = new BufferOutputStream(output,
+            final BufferOutputStream tos = new BufferOutputStream(output,
                     outputItem.getOffset());
-            BinaryOutputStream bos = new BinaryOutputStream(tos, byteOrder);
+            final BinaryOutputStream bos = new BinaryOutputStream(tos, byteOrder);
             outputItem.writeItem(bos);
         }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java Tue Dec  4 17:23:16 2012
@@ -29,55 +29,55 @@ public class TiffImageWriterLossy extend
     public TiffImageWriterLossy() {
     }
 
-    public TiffImageWriterLossy(ByteOrder byteOrder) {
+    public TiffImageWriterLossy(final ByteOrder byteOrder) {
         super(byteOrder);
     }
 
     @Override
-    public void write(OutputStream os, TiffOutputSet outputSet)
+    public void write(final OutputStream os, final TiffOutputSet outputSet)
             throws IOException, ImageWriteException {
-        TiffOutputSummary outputSummary = validateDirectories(outputSet);
+        final TiffOutputSummary outputSummary = validateDirectories(outputSet);
 
-        List<TiffOutputItem> outputItems = outputSet
+        final List<TiffOutputItem> outputItems = outputSet
                 .getOutputItems(outputSummary);
 
         updateOffsetsStep(outputItems);
 
         outputSummary.updateOffsets(byteOrder);
 
-        BinaryOutputStream bos = new BinaryOutputStream(os, byteOrder);
+        final BinaryOutputStream bos = new BinaryOutputStream(os, byteOrder);
 
         writeStep(bos, outputItems);
     }
 
-    private void updateOffsetsStep(List<TiffOutputItem> outputItems) {
+    private void updateOffsetsStep(final List<TiffOutputItem> outputItems) {
         int offset = TIFF_HEADER_SIZE;
 
         for (int i = 0; i < outputItems.size(); i++) {
-            TiffOutputItem outputItem = outputItems.get(i);
+            final TiffOutputItem outputItem = outputItems.get(i);
 
             outputItem.setOffset(offset);
-            int itemLength = outputItem.getItemLength();
+            final int itemLength = outputItem.getItemLength();
             offset += itemLength;
 
-            int remainder = imageDataPaddingLength(itemLength);
+            final int remainder = imageDataPaddingLength(itemLength);
             offset += remainder;
         }
     }
 
-    private void writeStep(BinaryOutputStream bos,
-            List<TiffOutputItem> outputItems) throws IOException,
+    private void writeStep(final BinaryOutputStream bos,
+            final List<TiffOutputItem> outputItems) throws IOException,
             ImageWriteException {
         writeImageFileHeader(bos);
 
         for (int i = 0; i < outputItems.size(); i++) {
-            TiffOutputItem outputItem = outputItems.get(i);
+            final TiffOutputItem outputItem = outputItems.get(i);
 
             outputItem.writeItem(bos);
 
-            int length = outputItem.getItemLength();
+            final int length = outputItem.getItemLength();
 
-            int remainder = imageDataPaddingLength(length);
+            final int remainder = imageDataPaddingLength(length);
             for (int j = 0; j < remainder; j++) {
                 bos.write(0);
             }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java Tue Dec  4 17:23:16 2012
@@ -64,7 +64,7 @@ public final class TiffOutputDirectory e
     private final ByteOrder byteOrder;
     private TiffOutputDirectory nextDirectory = null;
     public static final Comparator<TiffOutputDirectory> COMPARATOR = new Comparator<TiffOutputDirectory>() {
-        public int compare(TiffOutputDirectory o1, TiffOutputDirectory o2) {
+        public int compare(final TiffOutputDirectory o1, final TiffOutputDirectory o2) {
             if (o1.type < o2.type) {
                 return -1;
             } else if (o1.type > o2.type) {
@@ -75,7 +75,7 @@ public final class TiffOutputDirectory e
         }
     };
 
-    public void setNextDirectory(TiffOutputDirectory nextDirectory) {
+    public void setNextDirectory(final TiffOutputDirectory nextDirectory) {
         this.nextDirectory = nextDirectory;
     }
 
@@ -84,328 +84,328 @@ public final class TiffOutputDirectory e
         this.byteOrder = byteOrder;
     }
 
-    public void add(TagInfoByte tagInfo, byte... values)
+    public void add(final TagInfoByte tagInfo, final byte... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_BYTE, values.length,
                 bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoAscii tagInfo, String... values)
+    public void add(final TagInfoAscii tagInfo, final String... values)
             throws ImageWriteException {
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
         if (tagInfo.length > 0 && tagInfo.length != bytes.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " byte(s), not " + values.length);
         }
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_ASCII, bytes.length,
                 bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoShort tagInfo, short... values)
+    public void add(final TagInfoShort tagInfo, final short... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_SHORT,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoLong tagInfo, int... values)
+    public void add(final TagInfoLong tagInfo, final int... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_LONG, values.length,
                 bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoRational tagInfo, RationalNumber... values)
+    public void add(final TagInfoRational tagInfo, final RationalNumber... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_RATIONAL,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoSByte tagInfo, byte... values)
+    public void add(final TagInfoSByte tagInfo, final byte... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_SBYTE,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoSShort tagInfo, short... values)
+    public void add(final TagInfoSShort tagInfo, final short... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_SSHORT,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoSLong tagInfo, int... values)
+    public void add(final TagInfoSLong tagInfo, final int... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_SLONG,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoSRational tagInfo, RationalNumber... values)
+    public void add(final TagInfoSRational tagInfo, final RationalNumber... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_SRATIONAL,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoFloat tagInfo, float... values)
+    public void add(final TagInfoFloat tagInfo, final float... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_FLOAT,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoDouble tagInfo, double... values)
+    public void add(final TagInfoDouble tagInfo, final double... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_DOUBLE,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoByteOrShort tagInfo, byte... values)
+    public void add(final TagInfoByteOrShort tagInfo, final byte... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_BYTE, values.length,
                 bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoByteOrShort tagInfo, short... values)
+    public void add(final TagInfoByteOrShort tagInfo, final short... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_SHORT,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoShortOrLong tagInfo, short... values)
+    public void add(final TagInfoShortOrLong tagInfo, final short... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_SHORT,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoShortOrLong tagInfo, int... values)
+    public void add(final TagInfoShortOrLong tagInfo, final int... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_LONG, values.length,
                 bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoShortOrLongOrRational tagInfo, short... values)
+    public void add(final TagInfoShortOrLongOrRational tagInfo, final short... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_SHORT,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoShortOrLongOrRational tagInfo, int... values)
+    public void add(final TagInfoShortOrLongOrRational tagInfo, final int... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_LONG, values.length,
                 bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoShortOrLongOrRational tagInfo,
-            RationalNumber... values) throws ImageWriteException {
+    public void add(final TagInfoShortOrLongOrRational tagInfo,
+            final RationalNumber... values) throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_RATIONAL,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoShortOrRational tagInfo, short... values)
+    public void add(final TagInfoShortOrRational tagInfo, final short... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_SHORT,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoShortOrRational tagInfo, RationalNumber... values)
+    public void add(final TagInfoShortOrRational tagInfo, final RationalNumber... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(byteOrder, values);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final byte[] bytes = tagInfo.encodeValue(byteOrder, values);
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_RATIONAL,
                 values.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoGpsText tagInfo, String value)
+    public void add(final TagInfoGpsText tagInfo, final String value)
             throws ImageWriteException {
-        byte[] bytes = tagInfo.encodeValue(
+        final byte[] bytes = tagInfo.encodeValue(
                 TiffFieldTypeConstants.FIELD_TYPE_UNKNOWN, value, byteOrder);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, tagInfo.dataTypes.get(0), bytes.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoXpString tagInfo, String value)
+    public void add(final TagInfoXpString tagInfo, final String value)
             throws ImageWriteException {
-        byte[] bytes = tagInfo.encodeValue(
+        final byte[] bytes = tagInfo.encodeValue(
                 TiffFieldTypeConstants.FIELD_TYPE_BYTE, value, byteOrder);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_BYTE, bytes.length,
                 bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoAsciiOrByte tagInfo, String... values)
+    public void add(final TagInfoAsciiOrByte tagInfo, final String... values)
             throws ImageWriteException {
-        byte[] bytes = tagInfo.encodeValue(
+        final byte[] bytes = tagInfo.encodeValue(
                 TiffFieldTypeConstants.FIELD_TYPE_ASCII, values, byteOrder);
         if (tagInfo.length > 0 && tagInfo.length != bytes.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " byte(s), not " + values.length);
         }
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_ASCII, bytes.length,
                 bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoAsciiOrRational tagInfo, String... values)
+    public void add(final TagInfoAsciiOrRational tagInfo, final String... values)
             throws ImageWriteException {
-        byte[] bytes = tagInfo.encodeValue(
+        final byte[] bytes = tagInfo.encodeValue(
                 TiffFieldTypeConstants.FIELD_TYPE_ASCII, values, byteOrder);
         if (tagInfo.length > 0 && tagInfo.length != bytes.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " byte(s), not " + values.length);
         }
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_ASCII, bytes.length,
                 bytes);
         add(tiffOutputField);
     }
 
-    public void add(TagInfoAsciiOrRational tagInfo, RationalNumber... values)
+    public void add(final TagInfoAsciiOrRational tagInfo, final RationalNumber... values)
             throws ImageWriteException {
         if (tagInfo.length > 0 && tagInfo.length != values.length) {
             throw new ImageWriteException("Tag expects " + tagInfo.length
                     + " value(s), not " + values.length);
         }
-        byte[] bytes = tagInfo.encodeValue(
+        final byte[] bytes = tagInfo.encodeValue(
                 TiffFieldTypeConstants.FIELD_TYPE_RATIONAL, values, byteOrder);
-        TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+        final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
                 tagInfo, TiffFieldTypeConstants.FIELD_TYPE_RATIONAL,
                 bytes.length, bytes);
         add(tiffOutputField);
     }
 
-    public void add(TiffOutputField field) {
+    public void add(final TiffOutputField field) {
         fields.add(field);
     }
 
@@ -413,14 +413,14 @@ public final class TiffOutputDirectory e
         return new ArrayList<TiffOutputField>(fields);
     }
 
-    public void removeField(TagInfo tagInfo) {
+    public void removeField(final TagInfo tagInfo) {
         removeField(tagInfo.tag);
     }
 
-    public void removeField(int tag) {
-        List<TiffOutputField> matches = new ArrayList<TiffOutputField>();
+    public void removeField(final int tag) {
+        final List<TiffOutputField> matches = new ArrayList<TiffOutputField>();
         for (int i = 0; i < fields.size(); i++) {
-            TiffOutputField field = fields.get(i);
+            final TiffOutputField field = fields.get(i);
             if (field.tag == tag) {
                 matches.add(field);
             }
@@ -428,13 +428,13 @@ public final class TiffOutputDirectory e
         fields.removeAll(matches);
     }
 
-    public TiffOutputField findField(TagInfo tagInfo) {
+    public TiffOutputField findField(final TagInfo tagInfo) {
         return findField(tagInfo.tag);
     }
 
-    public TiffOutputField findField(int tag) {
+    public TiffOutputField findField(final int tag) {
         for (int i = 0; i < fields.size(); i++) {
-            TiffOutputField field = fields.get(i);
+            final TiffOutputField field = fields.get(i);
             if (field.tag == tag) {
                 return field;
             }
@@ -443,8 +443,8 @@ public final class TiffOutputDirectory e
     }
 
     public void sortFields() {
-        Comparator<TiffOutputField> comparator = new Comparator<TiffOutputField>() {
-            public int compare(TiffOutputField e1, TiffOutputField e2) {
+        final Comparator<TiffOutputField> comparator = new Comparator<TiffOutputField>() {
+            public int compare(final TiffOutputField e1, final TiffOutputField e2) {
                 if (e1.tag != e2.tag) {
                     return e1.tag - e2.tag;
                 }
@@ -459,14 +459,14 @@ public final class TiffOutputDirectory e
     }
 
     @Override
-    public void writeItem(BinaryOutputStream bos) throws IOException,
+    public void writeItem(final BinaryOutputStream bos) throws IOException,
             ImageWriteException {
         // Write Directory Field Count
         bos.write2Bytes(fields.size()); // DirectoryFieldCount
 
         // Write Fields
         for (int i = 0; i < fields.size(); i++) {
-            TiffOutputField field = fields.get(i);
+            final TiffOutputField field = fields.get(i);
             field.writeField(bos);
 
             // Debug.debug("\t" + "writing field (" + field.tag + ", 0x" +
@@ -490,7 +490,7 @@ public final class TiffOutputDirectory e
 
     private JpegImageData jpegImageData = null;
 
-    public void setJpegImageData(JpegImageData rawJpegImageData) {
+    public void setJpegImageData(final JpegImageData rawJpegImageData) {
         this.jpegImageData = rawJpegImageData;
     }
 
@@ -500,7 +500,7 @@ public final class TiffOutputDirectory e
 
     private TiffImageData tiffImageData = null;
 
-    public void setTiffImageData(TiffImageData rawTiffImageData) {
+    public void setTiffImageData(final TiffImageData rawTiffImageData) {
         this.tiffImageData = rawTiffImageData;
     }
 
@@ -516,20 +516,20 @@ public final class TiffOutputDirectory e
 
     @Override
     public String getItemDescription() {
-        TiffDirectoryType dirType = TagConstantsUtils
+        final TiffDirectoryType dirType = TagConstantsUtils
                 .getExifDirectoryType(type);
         return "Directory: " + dirType.name + " (" + type + ")";
     }
 
-    private void removeFieldIfPresent(TagInfo tagInfo) {
-        TiffOutputField field = findField(tagInfo);
+    private void removeFieldIfPresent(final TagInfo tagInfo) {
+        final TiffOutputField field = findField(tagInfo);
         if (null != field) {
             fields.remove(field);
         }
     }
 
     protected List<TiffOutputItem> getOutputItems(
-            TiffOutputSummary outputSummary) throws ImageWriteException {
+            final TiffOutputSummary outputSummary) throws ImageWriteException {
         // first validate directory fields.
 
         removeFieldIfPresent(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT);
@@ -542,11 +542,11 @@ public final class TiffOutputDirectory e
                     FIELD_TYPE_LONG, 1, FieldType.getStubLocalValue());
             add(jpegOffsetField);
 
-            byte lengthValue[] = FIELD_TYPE_LONG.writeData(
+            final byte lengthValue[] = FIELD_TYPE_LONG.writeData(
                     new int[] { jpegImageData.length, },
                     outputSummary.byteOrder);
 
-            TiffOutputField jpegLengthField = new TiffOutputField(
+            final TiffOutputField jpegLengthField = new TiffOutputField(
                     TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH,
                     FIELD_TYPE_LONG, 1, lengthValue);
             add(jpegLengthField);
@@ -563,7 +563,7 @@ public final class TiffOutputDirectory e
         TiffOutputField imageDataOffsetField;
         ImageDataOffsets imageDataInfo = null;
         if (null != tiffImageData) {
-            boolean stripsNotTiles = tiffImageData.stripsNotTiles();
+            final boolean stripsNotTiles = tiffImageData.stripsNotTiles();
 
             TagInfo offsetTag;
             TagInfo byteCountsTag;
@@ -577,7 +577,7 @@ public final class TiffOutputDirectory e
 
             // --------
 
-            TiffElement.DataElement imageData[] = tiffImageData.getImageData();
+            final TiffElement.DataElement imageData[] = tiffImageData.getImageData();
 
             int imageDataOffsets[] = null;
             int imageDataByteCounts[] = null;
@@ -600,9 +600,9 @@ public final class TiffOutputDirectory e
 
             // --------
 
-            byte data[] = FIELD_TYPE_LONG.writeData(imageDataByteCounts,
+            final byte data[] = FIELD_TYPE_LONG.writeData(imageDataByteCounts,
                     outputSummary.byteOrder);
-            TiffOutputField byteCountsField = new TiffOutputField(
+            final TiffOutputField byteCountsField = new TiffOutputField(
                     byteCountsTag, FIELD_TYPE_LONG, imageDataByteCounts.length,
                     data);
             add(byteCountsField);
@@ -615,23 +615,23 @@ public final class TiffOutputDirectory e
 
         // --------------------------------------------------------------
 
-        List<TiffOutputItem> result = new ArrayList<TiffOutputItem>();
+        final List<TiffOutputItem> result = new ArrayList<TiffOutputItem>();
         result.add(this);
         sortFields();
 
         for (int i = 0; i < fields.size(); i++) {
-            TiffOutputField field = fields.get(i);
+            final TiffOutputField field = fields.get(i);
             if (field.isLocalValue()) {
                 continue;
             }
 
-            TiffOutputItem item = field.getSeperateValue();
+            final TiffOutputItem item = field.getSeperateValue();
             result.add(item);
             // outputSummary.add(item, field);
         }
 
         if (null != imageDataInfo) {
-            for (TiffOutputItem outputItem : imageDataInfo.outputItems) {
+            for (final TiffOutputItem outputItem : imageDataInfo.outputItems) {
                 result.add(outputItem);
             }
 
@@ -639,7 +639,7 @@ public final class TiffOutputDirectory e
         }
 
         if (null != jpegImageData) {
-            TiffOutputItem item = new TiffOutputItem.Value("JPEG image data",
+            final TiffOutputItem item = new TiffOutputItem.Value("JPEG image data",
                     jpegImageData.data);
             result.add(item);
             outputSummary.add(item, jpegOffsetField);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java Tue Dec  4 17:23:16 2012
@@ -35,13 +35,13 @@ public class TiffOutputField implements 
 
     private final TiffOutputItem.Value separateValueItem;
 
-    public TiffOutputField(TagInfo tagInfo, FieldType tagtype, int count,
-            byte bytes[]) {
+    public TiffOutputField(final TagInfo tagInfo, final FieldType tagtype, final int count,
+            final byte bytes[]) {
         this(tagInfo.tag, tagInfo, tagtype, count, bytes);
     }
 
-    public TiffOutputField(final int tag, TagInfo tagInfo, FieldType fieldType,
-            int count, byte bytes[]) {
+    public TiffOutputField(final int tag, final TagInfo tagInfo, final FieldType fieldType,
+            final int count, final byte bytes[]) {
         this.tag = tag;
         this.tagInfo = tagInfo;
         this.fieldType = fieldType;
@@ -51,7 +51,7 @@ public class TiffOutputField implements 
         if (isLocalValue()) {
             separateValueItem = null;
         } else {
-            String name = "Field Seperate value (" + tagInfo.getDescription()
+            final String name = "Field Seperate value (" + tagInfo.getDescription()
                     + ")";
             separateValueItem = new TiffOutputItem.Value(name, bytes);
         }
@@ -59,13 +59,13 @@ public class TiffOutputField implements 
 
     private int sortHint = -1;
 
-    protected static final TiffOutputField createOffsetField(TagInfo tagInfo,
-            ByteOrder byteOrder) throws ImageWriteException {
+    protected static final TiffOutputField createOffsetField(final TagInfo tagInfo,
+            final ByteOrder byteOrder) throws ImageWriteException {
         return new TiffOutputField(tagInfo, FIELD_TYPE_LONG, 1,
                 FIELD_TYPE_LONG.writeData(new int[] { 0, }, byteOrder));
     }
 
-    protected void writeField(BinaryOutputStream bos) throws IOException,
+    protected void writeField(final BinaryOutputStream bos) throws IOException,
             ImageWriteException {
         bos.write2Bytes(tag);
         bos.write2Bytes(fieldType.type);
@@ -81,7 +81,7 @@ public class TiffOutputField implements 
             }
 
             bos.writeByteArray(bytes);
-            int remainder = TIFF_ENTRY_MAX_VALUE_LENGTH - bytes.length;
+            final int remainder = TIFF_ENTRY_MAX_VALUE_LENGTH - bytes.length;
             for (int i = 0; i < remainder; i++) {
                 bos.write(0);
             }
@@ -102,7 +102,7 @@ public class TiffOutputField implements 
         return bytes.length <= TIFF_ENTRY_MAX_VALUE_LENGTH;
     }
 
-    protected void setData(byte bytes[]) throws ImageWriteException {
+    protected void setData(final byte bytes[]) throws ImageWriteException {
         // if(tagInfo.isUnknown())
         // Debug.debug("unknown tag(0x" + Integer.toHexString(tag)
         // + ") setData", bytes);
@@ -132,7 +132,7 @@ public class TiffOutputField implements 
         if (prefix == null) {
             prefix = "";
         }
-        StringBuilder result = new StringBuilder();
+        final StringBuilder result = new StringBuilder();
 
         result.append(prefix);
         result.append(tagInfo);
@@ -153,7 +153,7 @@ public class TiffOutputField implements 
         return sortHint;
     }
 
-    public void setSortHint(int sortHint) {
+    public void setSortHint(final int sortHint) {
         this.sortHint = sortHint;
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputItem.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputItem.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputItem.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputItem.java Tue Dec  4 17:23:16 2012
@@ -31,7 +31,7 @@ abstract class TiffOutputItem implements
         return offset;
     }
 
-    protected void setOffset(int offset) {
+    protected void setOffset(final int offset) {
         this.offset = offset;
     }
 
@@ -61,7 +61,7 @@ abstract class TiffOutputItem implements
             return name;
         }
 
-        public void updateValue(byte bytes[]) throws ImageWriteException {
+        public void updateValue(final byte bytes[]) throws ImageWriteException {
             if (this.bytes.length != bytes.length) {
                 throw new ImageWriteException("Updated data size mismatch: "
                         + this.bytes.length + " vs. " + bytes.length);
@@ -70,7 +70,7 @@ abstract class TiffOutputItem implements
         }
 
         @Override
-        public void writeItem(BinaryOutputStream bos) throws IOException,
+        public void writeItem(final BinaryOutputStream bos) throws IOException,
                 ImageWriteException {
             bos.write(bytes);
         }



Mime
View raw message