commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1342971 [10/20] - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/formats/bmp/ main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/ main/java/org/apache/commons/imaging/formats/bmp/writers/ main/java/or...
Date Sat, 26 May 2012 21:19:22 GMT
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java Sat May 26 21:19:03 2012
@@ -42,25 +42,22 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoXpString;
 
 public class TiffDirectory extends TiffElement implements TiffConstants
-//extends BinaryFileFunctions
+// extends BinaryFileFunctions
 {
 
-    public String description()
-    {
+    public String description() {
         return TiffDirectory.description(type);
     }
 
     @Override
-    public String getElementDescription(boolean verbose)
-    {
+    public String getElementDescription(boolean verbose) {
         if (!verbose)
             return "TIFF Directory (" + description() + ")";
 
         int entryOffset = offset + TIFF_DIRECTORY_HEADER_LENGTH;
 
         StringBuffer result = new StringBuffer();
-        for (int i = 0; i < entries.size(); i++)
-        {
+        for (int i = 0; i < entries.size(); i++) {
             TiffField entry = entries.get(i);
 
             result.append("\t");
@@ -75,42 +72,39 @@ public class TiffDirectory extends TiffE
             result.append("\n");
 
             entryOffset += TIFF_ENTRY_LENGTH;
-            //            entry.fillInValue(byteSource);
+            // entry.fillInValue(byteSource);
         }
         return result.toString();
     }
 
-    public static final String description(int type)
-    {
-        switch (type)
-        {
-            case DIRECTORY_TYPE_UNKNOWN :
-                return "Unknown";
-            case DIRECTORY_TYPE_ROOT :
-                return "Root";
-            case DIRECTORY_TYPE_SUB :
-                return "Sub";
-            case DIRECTORY_TYPE_THUMBNAIL :
-                return "Thumbnail";
-            case DIRECTORY_TYPE_EXIF :
-                return "Exif";
-            case DIRECTORY_TYPE_GPS :
-                return "Gps";
-            case DIRECTORY_TYPE_INTEROPERABILITY :
-                return "Interoperability";
-            default :
-                return "Bad Type";
+    public static final String description(int type) {
+        switch (type) {
+        case DIRECTORY_TYPE_UNKNOWN:
+            return "Unknown";
+        case DIRECTORY_TYPE_ROOT:
+            return "Root";
+        case DIRECTORY_TYPE_SUB:
+            return "Sub";
+        case DIRECTORY_TYPE_THUMBNAIL:
+            return "Thumbnail";
+        case DIRECTORY_TYPE_EXIF:
+            return "Exif";
+        case DIRECTORY_TYPE_GPS:
+            return "Gps";
+        case DIRECTORY_TYPE_INTEROPERABILITY:
+            return "Interoperability";
+        default:
+            return "Bad Type";
         }
     }
 
     public final int type;
     public final List<TiffField> entries;
-    //    public final int offset;
+    // public final int offset;
     public final int nextDirectoryOffset;
 
     public TiffDirectory(int type, List<TiffField> entries, final int offset,
-            int nextDirectoryOffset)
-    {
+            int nextDirectoryOffset) {
         super(offset, TIFF_DIRECTORY_HEADER_LENGTH + entries.size()
                 * TIFF_ENTRY_LENGTH + TIFF_DIRECTORY_FOOTER_LENGTH);
 
@@ -119,31 +113,26 @@ public class TiffDirectory extends TiffE
         this.nextDirectoryOffset = nextDirectoryOffset;
     }
 
-    public List<TiffField> getDirectoryEntrys()
-    {
+    public List<TiffField> getDirectoryEntrys() {
         return new ArrayList<TiffField>(entries);
     }
 
-    public void dump()
-    {
-        for (int i = 0; i < entries.size(); i++)
-        {
+    public void dump() {
+        for (int i = 0; i < entries.size(); i++) {
             TiffField entry = entries.get(i);
             entry.dump();
         }
 
     }
 
-    public boolean hasJpegImageData() throws ImageReadException
-    {
+    public boolean hasJpegImageData() throws ImageReadException {
         if (null != findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT))
             return true;
 
         return false;
     }
 
-    public boolean hasTiffImageData() throws ImageReadException
-    {
+    public boolean hasTiffImageData() throws ImageReadException {
         if (null != findField(TiffTagConstants.TIFF_TAG_TILE_OFFSETS))
             return true;
 
@@ -153,35 +142,31 @@ public class TiffDirectory extends TiffE
         return false;
     }
 
-    public BufferedImage getTiffImage(int byteOrder) throws ImageReadException, IOException
-    {
+    public BufferedImage getTiffImage(int byteOrder) throws ImageReadException,
+            IOException {
         Map params = null;
         return getTiffImage(byteOrder, params);
     }
 
-    public BufferedImage getTiffImage(int byteOrder, Map params) throws ImageReadException,
-            IOException
-    {
+    public BufferedImage getTiffImage(int byteOrder, Map params)
+            throws ImageReadException, IOException {
         if (null == tiffImageData)
             return null;
 
         return new TiffImageParser().getBufferedImage(this, byteOrder, params);
     }
 
-    public TiffField findField(TagInfo tag) throws ImageReadException
-    {
+    public TiffField findField(TagInfo tag) throws ImageReadException {
         boolean failIfMissing = false;
         return findField(tag, failIfMissing);
     }
 
     public TiffField findField(TagInfo tag, boolean failIfMissing)
-            throws ImageReadException
-    {
+            throws ImageReadException {
         if (entries == null)
             return null;
 
-        for (int i = 0; i < entries.size(); i++)
-        {
+        for (int i = 0; i < entries.size(); i++) {
             TiffField field = entries.get(i);
             if (field.tag == tag.tag)
                 return field;
@@ -193,7 +178,7 @@ public class TiffDirectory extends TiffE
 
         return null;
     }
-    
+
     public Object getFieldValue(TagInfo tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -201,126 +186,150 @@ public class TiffDirectory extends TiffE
         }
         return field.getValue();
     }
-    
+
     public byte getSingleFieldValue(TagInfoByte tag) throws ImageReadException {
         byte[] result = getFieldValue(tag, true);
         if (result.length != 1) {
-            throw new ImageReadException("Field \"" + tag.name + "\" has incorrect length " + result.length);
+            throw new ImageReadException("Field \"" + tag.name
+                    + "\" has incorrect length " + result.length);
         }
         return result[0];
     }
-    
-    public String getSingleFieldValue(TagInfoAscii tag) throws ImageReadException {
+
+    public String getSingleFieldValue(TagInfoAscii tag)
+            throws ImageReadException {
         String[] result = getFieldValue(tag, true);
         if (result.length != 1) {
-            throw new ImageReadException("Field \"" + tag.name + "\" has incorrect length " + result.length);
+            throw new ImageReadException("Field \"" + tag.name
+                    + "\" has incorrect length " + result.length);
         }
         return result[0];
     }
-    
-    public short getSingleFieldValue(TagInfoShort tag) throws ImageReadException {
+
+    public short getSingleFieldValue(TagInfoShort tag)
+            throws ImageReadException {
         short[] result = getFieldValue(tag, true);
         if (result.length != 1) {
-            throw new ImageReadException("Field \"" + tag.name + "\" has incorrect length " + result.length);
+            throw new ImageReadException("Field \"" + tag.name
+                    + "\" has incorrect length " + result.length);
         }
         return result[0];
     }
-    
+
     public int getSingleFieldValue(TagInfoLong tag) throws ImageReadException {
         int[] result = getFieldValue(tag, true);
         if (result.length != 1) {
-            throw new ImageReadException("Field \"" + tag.name + "\" has incorrect length " + result.length);
+            throw new ImageReadException("Field \"" + tag.name
+                    + "\" has incorrect length " + result.length);
         }
         return result[0];
     }
-    
-    public RationalNumber getSingleFieldValue(TagInfoRational tag) throws ImageReadException {
+
+    public RationalNumber getSingleFieldValue(TagInfoRational tag)
+            throws ImageReadException {
         RationalNumber[] result = getFieldValue(tag, true);
         if (result.length != 1) {
-            throw new ImageReadException("Field \"" + tag.name + "\" has incorrect length " + result.length);
+            throw new ImageReadException("Field \"" + tag.name
+                    + "\" has incorrect length " + result.length);
         }
         return result[0];
     }
-    
+
     public byte getSingleFieldValue(TagInfoSByte tag) throws ImageReadException {
         byte[] result = getFieldValue(tag, true);
         if (result.length != 1) {
-            throw new ImageReadException("Field \"" + tag.name + "\" has incorrect length " + result.length);
+            throw new ImageReadException("Field \"" + tag.name
+                    + "\" has incorrect length " + result.length);
         }
         return result[0];
     }
-    
-    public short getSingleFieldValue(TagInfoSShort tag) throws ImageReadException {
+
+    public short getSingleFieldValue(TagInfoSShort tag)
+            throws ImageReadException {
         short[] result = getFieldValue(tag, true);
         if (result.length != 1) {
-            throw new ImageReadException("Field \"" + tag.name + "\" has incorrect length " + result.length);
+            throw new ImageReadException("Field \"" + tag.name
+                    + "\" has incorrect length " + result.length);
         }
         return result[0];
     }
-    
+
     public int getSingleFieldValue(TagInfoSLong tag) throws ImageReadException {
         int[] result = getFieldValue(tag, true);
         if (result.length != 1) {
-            throw new ImageReadException("Field \"" + tag.name + "\" has incorrect length " + result.length);
+            throw new ImageReadException("Field \"" + tag.name
+                    + "\" has incorrect length " + result.length);
         }
         return result[0];
     }
-    
-    public RationalNumber getSingleFieldValue(TagInfoSRational tag) throws ImageReadException {
+
+    public RationalNumber getSingleFieldValue(TagInfoSRational tag)
+            throws ImageReadException {
         RationalNumber[] result = getFieldValue(tag, true);
         if (result.length != 1) {
-            throw new ImageReadException("Field \"" + tag.name + "\" has incorrect length " + result.length);
+            throw new ImageReadException("Field \"" + tag.name
+                    + "\" has incorrect length " + result.length);
         }
         return result[0];
     }
-    
-    public float getSingleFieldValue(TagInfoFloat tag) throws ImageReadException {
+
+    public float getSingleFieldValue(TagInfoFloat tag)
+            throws ImageReadException {
         float[] result = getFieldValue(tag, true);
         if (result.length != 1) {
-            throw new ImageReadException("Field \"" + tag.name + "\" has incorrect length " + result.length);
+            throw new ImageReadException("Field \"" + tag.name
+                    + "\" has incorrect length " + result.length);
         }
         return result[0];
     }
-    
-    public double getSingleFieldValue(TagInfoDouble tag) throws ImageReadException {
+
+    public double getSingleFieldValue(TagInfoDouble tag)
+            throws ImageReadException {
         double[] result = getFieldValue(tag, true);
         if (result.length != 1) {
-            throw new ImageReadException("Field \"" + tag.name + "\" has incorrect length " + result.length);
+            throw new ImageReadException("Field \"" + tag.name
+                    + "\" has incorrect length " + result.length);
         }
         return result[0];
     }
-    
-    public byte[] getFieldValue(TagInfoByte tag, boolean mustExist) throws ImageReadException {
+
+    public byte[] getFieldValue(TagInfoByte tag, boolean mustExist)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         if (!tag.dataTypes.contains(field.fieldType)) {
-            if (mustExist){
-                throw new ImageReadException("Required field \"" + tag.name + "\" has incorrect type " + field.fieldType.name);
+            if (mustExist) {
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" has incorrect type " + field.fieldType.name);
             } else {
                 return null;
             }
         }
         return field.fieldType.getRawBytes(field);
     }
-    
-    public String[] getFieldValue(TagInfoAscii tag, boolean mustExist) throws ImageReadException {
+
+    public String[] getFieldValue(TagInfoAscii tag, boolean mustExist)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         if (!tag.dataTypes.contains(field.fieldType)) {
-            if (mustExist){
-                throw new ImageReadException("Required field \"" + tag.name + "\" has incorrect type " + field.fieldType.name);
+            if (mustExist) {
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" has incorrect type " + field.fieldType.name);
             } else {
                 return null;
             }
@@ -328,19 +337,22 @@ public class TiffDirectory extends TiffE
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
-    public short[] getFieldValue(TagInfoShort tag, boolean mustExist) throws ImageReadException {
+
+    public short[] getFieldValue(TagInfoShort tag, boolean mustExist)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         if (!tag.dataTypes.contains(field.fieldType)) {
-            if (mustExist){
-                throw new ImageReadException("Required field \"" + tag.name + "\" has incorrect type " + field.fieldType.name);
+            if (mustExist) {
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" has incorrect type " + field.fieldType.name);
             } else {
                 return null;
             }
@@ -348,19 +360,22 @@ public class TiffDirectory extends TiffE
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
-    public int[] getFieldValue(TagInfoLong tag, boolean mustExist) throws ImageReadException {
+
+    public int[] getFieldValue(TagInfoLong tag, boolean mustExist)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         if (!tag.dataTypes.contains(field.fieldType)) {
-            if (mustExist){
-                throw new ImageReadException("Required field \"" + tag.name + "\" has incorrect type " + field.fieldType.name);
+            if (mustExist) {
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" has incorrect type " + field.fieldType.name);
             } else {
                 return null;
             }
@@ -368,19 +383,22 @@ public class TiffDirectory extends TiffE
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
-    public RationalNumber[] getFieldValue(TagInfoRational tag, boolean mustExist) throws ImageReadException {
+
+    public RationalNumber[] getFieldValue(TagInfoRational tag, boolean mustExist)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         if (!tag.dataTypes.contains(field.fieldType)) {
-            if (mustExist){
-                throw new ImageReadException("Required field \"" + tag.name + "\" has incorrect type " + field.fieldType.name);
+            if (mustExist) {
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" has incorrect type " + field.fieldType.name);
             } else {
                 return null;
             }
@@ -388,38 +406,44 @@ public class TiffDirectory extends TiffE
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
-    public byte[] getFieldValue(TagInfoSByte tag, boolean mustExist) throws ImageReadException {
+
+    public byte[] getFieldValue(TagInfoSByte tag, boolean mustExist)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         if (!tag.dataTypes.contains(field.fieldType)) {
-            if (mustExist){
-                throw new ImageReadException("Required field \"" + tag.name + "\" has incorrect type " + field.fieldType.name);
+            if (mustExist) {
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" has incorrect type " + field.fieldType.name);
             } else {
                 return null;
             }
         }
         return field.fieldType.getRawBytes(field);
     }
-    
-    public short[] getFieldValue(TagInfoSShort tag, boolean mustExist) throws ImageReadException {
+
+    public short[] getFieldValue(TagInfoSShort tag, boolean mustExist)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         if (!tag.dataTypes.contains(field.fieldType)) {
-            if (mustExist){
-                throw new ImageReadException("Required field \"" + tag.name + "\" has incorrect type " + field.fieldType.name);
+            if (mustExist) {
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" has incorrect type " + field.fieldType.name);
             } else {
                 return null;
             }
@@ -427,19 +451,22 @@ public class TiffDirectory extends TiffE
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
-    public int[] getFieldValue(TagInfoSLong tag, boolean mustExist) throws ImageReadException {
+
+    public int[] getFieldValue(TagInfoSLong tag, boolean mustExist)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         if (!tag.dataTypes.contains(field.fieldType)) {
-            if (mustExist){
-                throw new ImageReadException("Required field \"" + tag.name + "\" has incorrect type " + field.fieldType.name);
+            if (mustExist) {
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" has incorrect type " + field.fieldType.name);
             } else {
                 return null;
             }
@@ -447,19 +474,22 @@ public class TiffDirectory extends TiffE
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
-    public RationalNumber[] getFieldValue(TagInfoSRational tag, boolean mustExist) throws ImageReadException {
+
+    public RationalNumber[] getFieldValue(TagInfoSRational tag,
+            boolean mustExist) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         if (!tag.dataTypes.contains(field.fieldType)) {
-            if (mustExist){
-                throw new ImageReadException("Required field \"" + tag.name + "\" has incorrect type " + field.fieldType.name);
+            if (mustExist) {
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" has incorrect type " + field.fieldType.name);
             } else {
                 return null;
             }
@@ -467,19 +497,22 @@ public class TiffDirectory extends TiffE
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
-    public float[] getFieldValue(TagInfoFloat tag, boolean mustExist) throws ImageReadException {
+
+    public float[] getFieldValue(TagInfoFloat tag, boolean mustExist)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         if (!tag.dataTypes.contains(field.fieldType)) {
-            if (mustExist){
-                throw new ImageReadException("Required field \"" + tag.name + "\" has incorrect type " + field.fieldType.name);
+            if (mustExist) {
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" has incorrect type " + field.fieldType.name);
             } else {
                 return null;
             }
@@ -487,19 +520,22 @@ public class TiffDirectory extends TiffE
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
-    public double[] getFieldValue(TagInfoDouble tag, boolean mustExist) throws ImageReadException {
+
+    public double[] getFieldValue(TagInfoDouble tag, boolean mustExist)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         if (!tag.dataTypes.contains(field.fieldType)) {
-            if (mustExist){
-                throw new ImageReadException("Required field \"" + tag.name + "\" has incorrect type " + field.fieldType.name);
+            if (mustExist) {
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" has incorrect type " + field.fieldType.name);
             } else {
                 return null;
             }
@@ -507,50 +543,51 @@ public class TiffDirectory extends TiffE
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
-    public String getFieldValue(TagInfoGpsText tag, boolean mustExist) throws ImageReadException {
+
+    public String getFieldValue(TagInfoGpsText tag, boolean mustExist)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         return tag.getValue(field);
     }
-    
-    public String getFieldValue(TagInfoXpString tag, boolean mustExist) throws ImageReadException {
+
+    public String getFieldValue(TagInfoXpString tag, boolean mustExist)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             if (mustExist) {
-                throw new ImageReadException("Required field \"" + tag.name + "\" is missing");
+                throw new ImageReadException("Required field \"" + tag.name
+                        + "\" is missing");
             } else {
                 return null;
             }
         }
         return tag.getValue(field);
     }
-    
-    public static final class ImageDataElement extends TiffElement
-    {
-        public ImageDataElement(int offset, int length)
-        {
+
+    public static final class ImageDataElement extends TiffElement {
+        public ImageDataElement(int offset, int length) {
             super(offset, length);
         }
 
         @Override
-        public String getElementDescription(boolean verbose)
-        {
+        public String getElementDescription(boolean verbose) {
             if (verbose)
                 return null;
             return "ImageDataElement";
         }
     }
 
-    private List<ImageDataElement> getRawImageDataElements(TiffField offsetsField,
-            TiffField byteCountsField) throws ImageReadException
-    {
+    private List<ImageDataElement> getRawImageDataElements(
+            TiffField offsetsField, TiffField byteCountsField)
+            throws ImageReadException {
         int offsets[] = offsetsField.getIntArrayValue();
         int byteCounts[] = byteCountsField.getIntArrayValue();
 
@@ -559,34 +596,28 @@ public class TiffDirectory extends TiffE
                     + ") != byteCounts.length(" + byteCounts.length + ")");
 
         List<ImageDataElement> result = new ArrayList<ImageDataElement>();
-        for (int i = 0; i < offsets.length; i++)
-        {
+        for (int i = 0; i < offsets.length; i++) {
             result.add(new ImageDataElement(offsets[i], byteCounts[i]));
         }
         return result;
     }
 
-    public List<ImageDataElement> getTiffRawImageDataElements() throws ImageReadException
-    {
+    public List<ImageDataElement> getTiffRawImageDataElements()
+            throws ImageReadException {
         TiffField tileOffsets = findField(TiffTagConstants.TIFF_TAG_TILE_OFFSETS);
         TiffField tileByteCounts = findField(TiffTagConstants.TIFF_TAG_TILE_BYTE_COUNTS);
         TiffField stripOffsets = findField(TiffTagConstants.TIFF_TAG_STRIP_OFFSETS);
         TiffField stripByteCounts = findField(TiffTagConstants.TIFF_TAG_STRIP_BYTE_COUNTS);
 
-        if ((tileOffsets != null) && (tileByteCounts != null))
-        {
+        if ((tileOffsets != null) && (tileByteCounts != null)) {
             return getRawImageDataElements(tileOffsets, tileByteCounts);
-        }
-        else if ((stripOffsets != null) && (stripByteCounts != null))
-        {
+        } else if ((stripOffsets != null) && (stripByteCounts != null)) {
             return getRawImageDataElements(stripOffsets, stripByteCounts);
-        }
-        else
+        } else
             throw new ImageReadException("Couldn't find image data.");
     }
 
-    public boolean imageDataInStrips() throws ImageReadException
-    {
+    public boolean imageDataInStrips() throws ImageReadException {
         TiffField tileOffsets = findField(TiffTagConstants.TIFF_TAG_TILE_OFFSETS);
         TiffField tileByteCounts = findField(TiffTagConstants.TIFF_TAG_TILE_BYTE_COUNTS);
         TiffField stripOffsets = findField(TiffTagConstants.TIFF_TAG_STRIP_OFFSETS);
@@ -603,44 +634,37 @@ public class TiffDirectory extends TiffE
     }
 
     public ImageDataElement getJpegRawImageDataElement()
-            throws ImageReadException
-    {
+            throws ImageReadException {
         TiffField jpegInterchangeFormat = findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT);
         TiffField jpegInterchangeFormatLength = findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH);
 
         if ((jpegInterchangeFormat != null)
-                && (jpegInterchangeFormatLength != null))
-        {
+                && (jpegInterchangeFormatLength != null)) {
             int offset = jpegInterchangeFormat.getIntArrayValue()[0];
             int byteCount = jpegInterchangeFormatLength.getIntArrayValue()[0];
 
             return new ImageDataElement(offset, byteCount);
-        }
-        else
+        } else
             throw new ImageReadException("Couldn't find image data.");
     }
 
     private TiffImageData tiffImageData = null;
 
-    public void setTiffImageData(TiffImageData rawImageData)
-    {
+    public void setTiffImageData(TiffImageData rawImageData) {
         this.tiffImageData = rawImageData;
     }
 
-    public TiffImageData getTiffImageData()
-    {
+    public TiffImageData getTiffImageData() {
         return tiffImageData;
     }
 
     private JpegImageData jpegImageData = null;
 
-    public void setJpegImageData(JpegImageData value)
-    {
+    public void setJpegImageData(JpegImageData value) {
         this.jpegImageData = value;
     }
 
-    public JpegImageData getJpegImageData()
-    {
+    public JpegImageData getJpegImageData() {
         return jpegImageData;
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffElement.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffElement.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffElement.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffElement.java Sat May 26 21:19:03 2012
@@ -18,62 +18,52 @@ package org.apache.commons.imaging.forma
 
 import java.util.Comparator;
 
-public abstract class TiffElement
-{
+public abstract class TiffElement {
     public final int offset;
     public final int length;
 
-    public TiffElement(int offset, int length)
-    {
+    public TiffElement(int offset, int length) {
         this.offset = offset;
         this.length = length;
     }
 
-    public String getElementDescription()
-    {
+    public String getElementDescription() {
         return getElementDescription(false);
     }
 
     public abstract String getElementDescription(boolean verbose);
 
-    public static final Comparator<TiffElement> COMPARATOR = new Comparator<TiffElement>()
-    {
-        public int compare(TiffElement e1, TiffElement e2)
-        {
+    public static final Comparator<TiffElement> COMPARATOR = new Comparator<TiffElement>() {
+        public int compare(TiffElement e1, TiffElement e2) {
             return e1.offset - e2.offset;
         }
     };
 
-    public static abstract class DataElement extends TiffElement
-    {
+    public static abstract class DataElement extends TiffElement {
         public final byte data[];
 
-        public DataElement(int offset, int length, final byte data[])
-        {
+        public DataElement(int offset, int length, final byte data[]) {
             super(offset, length);
 
             this.data = data;
         }
-        
+
         public byte[] getData() {
             return data;
         }
 
     }
 
-    public static final class Stub extends TiffElement
-    {
-        public Stub(int offset, int length)
-        {
+    public static final class Stub extends TiffElement {
+        public Stub(int offset, int length) {
             super(offset, length);
         }
 
         @Override
-        public String getElementDescription(boolean verbose)
-        {
+        public String getElementDescription(boolean verbose) {
             return "Element, offset: " + offset + ", length: " + length
                     + ", last: " + (offset + length) + "";
         }
 
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java Sat May 26 21:19:03 2012
@@ -36,8 +36,7 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
 
-public class TiffField implements TiffConstants
-{
+public class TiffField implements TiffConstants {
     public final TagInfo tagInfo;
     public final FieldType fieldType;
 
@@ -52,8 +51,7 @@ public class TiffField implements TiffCo
     public final int byteOrder;
 
     public TiffField(int tag, int directoryType, int type, int Length,
-            int ValueOffset, byte ValueOffsetBytes[], int byteOrder)
-    {
+            int ValueOffset, byte ValueOffsetBytes[], int byteOrder) {
 
         this.tag = tag;
         this.directoryType = directoryType;
@@ -69,26 +67,21 @@ public class TiffField implements TiffCo
 
     private int sortHint = -1;
 
-    public boolean isLocalValue()
-    {
+    public boolean isLocalValue() {
         return fieldType.isLocalValue(this);
     }
 
-    public int getBytesLength() throws ImageReadException
-    {
+    public int getBytesLength() throws ImageReadException {
         return fieldType.getBytesLength(this);
     }
 
-    public final class OversizeValueElement extends TiffElement
-    {
-        public OversizeValueElement(int offset, int length)
-        {
+    public final class OversizeValueElement extends TiffElement {
+        public OversizeValueElement(int offset, int length) {
             super(offset, length);
         }
 
         @Override
-        public String getElementDescription(boolean verbose)
-        {
+        public String getElementDescription(boolean verbose) {
             if (verbose)
                 return null;
 
@@ -97,23 +90,19 @@ public class TiffField implements TiffCo
         }
     }
 
-    public TiffElement getOversizeValueElement()
-    {
+    public TiffElement getOversizeValueElement() {
         if (fieldType.isLocalValue(this))
             return null;
 
         return new OversizeValueElement(valueOffset, oversizeValue.length);
     }
 
-    public void setOversizeValue(byte bytes[])
-    {
+    public void setOversizeValue(byte bytes[]) {
         this.oversizeValue = bytes;
     }
 
-    private static FieldType getFieldType(int value)
-    {
-        for (int i = 0; i < FIELD_TYPES.size(); i++)
-        {
+    private static FieldType getFieldType(int value) {
+        for (int i = 0; i < FIELD_TYPES.size(); i++) {
             FieldType fieldType = FIELD_TYPES.get(i);
             if (fieldType.type == value)
                 return fieldType;
@@ -123,8 +112,7 @@ public class TiffField implements TiffCo
     }
 
     private static TagInfo getTag(int directoryType, int tag,
-            List<TagInfo> possibleMatches)
-    {
+            List<TagInfo> possibleMatches) {
         // Please keep this method in sync with TiffImageMetadata's findField()
 
         if (possibleMatches.size() < 1)
@@ -136,8 +124,7 @@ public class TiffField implements TiffCo
         // }
 
         // first search for exact match.
-        for (int i = 0; i < possibleMatches.size(); i++)
-        {
+        for (int i = 0; i < possibleMatches.size(); i++) {
             TagInfo tagInfo = possibleMatches.get(i);
             if (tagInfo.directoryType == TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN)
                 // pass
@@ -147,8 +134,7 @@ public class TiffField implements TiffCo
         }
 
         // accept an inexact match.
-        for (int i = 0; i < possibleMatches.size(); i++)
-        {
+        for (int i = 0; i < possibleMatches.size(); i++) {
             TagInfo tagInfo = possibleMatches.get(i);
 
             if (tagInfo.directoryType == TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN)
@@ -163,8 +149,7 @@ public class TiffField implements TiffCo
         }
 
         // accept a wildcard match.
-        for (int i = 0; i < possibleMatches.size(); i++)
-        {
+        for (int i = 0; i < possibleMatches.size(); i++) {
             TagInfo tagInfo = possibleMatches.get(i);
 
             if (tagInfo.directoryType == TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN)
@@ -252,12 +237,10 @@ public class TiffField implements TiffCo
         // return TIFF_TAG_UNKNOWN;
     }
 
-    private static TagInfo getTag(int directoryType, int tag)
-    {
+    private static TagInfo getTag(int directoryType, int tag) {
         List<TagInfo> possibleMatches = ALL_TAG_MAP.get(tag);
 
-        if (null == possibleMatches)
-        {
+        if (null == possibleMatches) {
             return TiffTagConstants.TIFF_TAG_UNKNOWN;
         }
 
@@ -265,8 +248,7 @@ public class TiffField implements TiffCo
         return result;
     }
 
-    private int getValueLengthInBytes()
-    {
+    private int getValueLengthInBytes() {
         int unit_length = fieldType.length;
         int valueLength = unit_length * length;
 
@@ -276,8 +258,8 @@ public class TiffField implements TiffCo
         return valueLength;
     }
 
-    public void fillInValue(ByteSource byteSource) throws IOException, TiffValueOutsideFileBoundsException
-    {
+    public void fillInValue(ByteSource byteSource) throws IOException,
+            TiffValueOutsideFileBoundsException {
         if (fieldType.isLocalValue(this))
             return;
 
@@ -289,54 +271,45 @@ public class TiffField implements TiffCo
         // Debug.debug("fillInValue valueOffset", valueOffset);
         // Debug.debug("fillInValue valueLength", valueLength);
 
-        if (valueOffset < 0 ||
-            valueOffset + valueLengthLong > byteSource.getLength()) {
+        if (valueOffset < 0
+                || valueOffset + valueLengthLong > byteSource.getLength()) {
             throw new TiffValueOutsideFileBoundsException(
-                "Attempt to read byte range starting from " + valueOffset + " " +
-                "of length " + valueLength + " " +
-                "which is outside the file's size of " + byteSource.getLength());
+                    "Attempt to read byte range starting from " + valueOffset
+                            + " " + "of length " + valueLength + " "
+                            + "which is outside the file's size of "
+                            + byteSource.getLength());
         }
         byte bytes[] = byteSource.getBlock(valueOffset, valueLength);
         setOversizeValue(bytes);
     }
 
-    public String getValueDescription()
-    {
-        try
-        {
+    public String getValueDescription() {
+        try {
             return getValueDescription(getValue());
-        } catch (ImageReadException e)
-        {
+        } catch (ImageReadException e) {
             return "Invalid value: " + e.getMessage();
         }
     }
 
-    private String getValueDescription(Object o)
-    {
+    private String getValueDescription(Object o) {
         if (o == null)
             return null;
 
-        if (o instanceof Number)
-        {
+        if (o instanceof Number) {
             return o.toString();
-        } else if (o instanceof String)
-        {
+        } else if (o instanceof String) {
             return "'" + o.toString().trim() + "'";
-        } else if (o instanceof Date)
-        {
+        } else if (o instanceof Date) {
             DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
             return df.format((Date) o);
-        } else if (o instanceof Object[])
-        {
+        } else if (o instanceof Object[]) {
             Object objects[] = (Object[]) o;
             StringBuffer result = new StringBuffer();
 
-            for (int i = 0; i < objects.length; i++)
-            {
+            for (int i = 0; i < objects.length; i++) {
                 Object object = objects[i];
 
-                if (i > 50)
-                {
+                if (i > 50) {
                     result.append("... (" + objects.length + ")");
                     break;
                 }
@@ -361,17 +334,14 @@ public class TiffField implements TiffCo
         // }
         // return result.toString();
         // }
-        else if (o instanceof short[])
-        {
+        else if (o instanceof short[]) {
             short values[] = (short[]) o;
             StringBuffer result = new StringBuffer();
 
-            for (int i = 0; i < values.length; i++)
-            {
+            for (int i = 0; i < values.length; i++) {
                 short value = values[i];
 
-                if (i > 50)
-                {
+                if (i > 50) {
                     result.append("... (" + values.length + ")");
                     break;
                 }
@@ -380,18 +350,14 @@ public class TiffField implements TiffCo
                 result.append("" + value);
             }
             return result.toString();
-        }
-        else if (o instanceof int[])
-        {
+        } else if (o instanceof int[]) {
             int values[] = (int[]) o;
             StringBuffer result = new StringBuffer();
 
-            for (int i = 0; i < values.length; i++)
-            {
+            for (int i = 0; i < values.length; i++) {
                 int value = values[i];
 
-                if (i > 50)
-                {
+                if (i > 50) {
                     result.append("... (" + values.length + ")");
                     break;
                 }
@@ -400,17 +366,14 @@ public class TiffField implements TiffCo
                 result.append("" + value);
             }
             return result.toString();
-        } else if (o instanceof long[])
-        {
+        } else if (o instanceof long[]) {
             long values[] = (long[]) o;
             StringBuffer result = new StringBuffer();
 
-            for (int i = 0; i < values.length; i++)
-            {
+            for (int i = 0; i < values.length; i++) {
                 long value = values[i];
 
-                if (i > 50)
-                {
+                if (i > 50) {
                     result.append("... (" + values.length + ")");
                     break;
                 }
@@ -419,17 +382,14 @@ public class TiffField implements TiffCo
                 result.append("" + value);
             }
             return result.toString();
-        } else if (o instanceof double[])
-        {
+        } else if (o instanceof double[]) {
             double values[] = (double[]) o;
             StringBuffer result = new StringBuffer();
 
-            for (int i = 0; i < values.length; i++)
-            {
+            for (int i = 0; i < values.length; i++) {
                 double value = values[i];
 
-                if (i > 50)
-                {
+                if (i > 50) {
                     result.append("... (" + values.length + ")");
                     break;
                 }
@@ -438,17 +398,14 @@ public class TiffField implements TiffCo
                 result.append("" + value);
             }
             return result.toString();
-        } else if (o instanceof byte[])
-        {
+        } else if (o instanceof byte[]) {
             byte values[] = (byte[]) o;
             StringBuffer result = new StringBuffer();
 
-            for (int i = 0; i < values.length; i++)
-            {
+            for (int i = 0; i < values.length; i++) {
                 byte value = values[i];
 
-                if (i > 50)
-                {
+                if (i > 50) {
                     result.append("... (" + values.length + ")");
                     break;
                 }
@@ -457,17 +414,14 @@ public class TiffField implements TiffCo
                 result.append("" + value);
             }
             return result.toString();
-        } else if (o instanceof char[])
-        {
+        } else if (o instanceof char[]) {
             char values[] = (char[]) o;
             StringBuffer result = new StringBuffer();
 
-            for (int i = 0; i < values.length; i++)
-            {
+            for (int i = 0; i < values.length; i++) {
                 char value = values[i];
 
-                if (i > 50)
-                {
+                if (i > 50) {
                     result.append("... (" + values.length + ")");
                     break;
                 }
@@ -476,17 +430,14 @@ public class TiffField implements TiffCo
                 result.append("" + value);
             }
             return result.toString();
-        } else if (o instanceof float[])
-        {
+        } else if (o instanceof float[]) {
             float values[] = (float[]) o;
             StringBuffer result = new StringBuffer();
 
-            for (int i = 0; i < values.length; i++)
-            {
+            for (int i = 0; i < values.length; i++) {
                 float value = values[i];
 
-                if (i > 50)
-                {
+                if (i > 50) {
                     result.append("... (" + values.length + ")");
                     break;
                 }
@@ -515,20 +466,17 @@ public class TiffField implements TiffCo
         return "Unknown: " + o.getClass().getName();
     }
 
-    public void dump()
-    {
+    public void dump() {
         PrintWriter pw = new PrintWriter(System.out);
         dump(pw);
         pw.flush();
     }
 
-    public void dump(PrintWriter pw)
-    {
+    public void dump(PrintWriter pw) {
         dump(pw, null);
     }
 
-    public void dump(PrintWriter pw, String prefix)
-    {
+    public void dump(PrintWriter pw, String prefix) {
         if (prefix != null)
             pw.print(prefix + ": ");
 
@@ -549,15 +497,13 @@ public class TiffField implements TiffCo
     // Debug.debug("byteOrder", byteOrder);
     // }
 
-    public String getDescriptionWithoutValue()
-    {
+    public String getDescriptionWithoutValue() {
         return tag + " (0x" + Integer.toHexString(tag) + ": " + tagInfo.name
                 + "): ";
     }
 
     @Override
-    public String toString()
-    {
+    public String toString() {
         StringBuffer result = new StringBuffer();
 
         result.append(tag + " (0x" + Integer.toHexString(tag) + ": "
@@ -568,28 +514,24 @@ public class TiffField implements TiffCo
         return result.toString();
     }
 
-    public String getTagName()
-    {
+    public String getTagName() {
         if (tagInfo == TiffTagConstants.TIFF_TAG_UNKNOWN)
             return tagInfo.name + " (0x" + Integer.toHexString(tag) + ")";
         return tagInfo.name;
     }
 
-    public String getFieldTypeName()
-    {
+    public String getFieldTypeName() {
         return fieldType.name;
     }
 
     public static final String Attribute_Tag = "Tag";
 
-    public Object getValue() throws ImageReadException
-    {
+    public Object getValue() throws ImageReadException {
         // System.out.print("getValue");
         return tagInfo.getValue(this);
     }
 
-    public String getStringValue() throws ImageReadException
-    {
+    public String getStringValue() throws ImageReadException {
         Object o = getValue();
         if (o == null)
             return null;
@@ -599,19 +541,16 @@ public class TiffField implements TiffCo
         return (String) o;
     }
 
-    private static final Map<Object, List<TagInfo>> makeTagMap(List<TagInfo> tags,
-                                                               boolean ignoreDuplicates, String name)
-    {
+    private static final Map<Object, List<TagInfo>> makeTagMap(
+            List<TagInfo> tags, boolean ignoreDuplicates, String name) {
         // make sure to use the thread-safe version; this is shared state.
         Map<Object, List<TagInfo>> map = new Hashtable<Object, List<TagInfo>>();
 
-        for (int i = 0; i < tags.size(); i++)
-        {
+        for (int i = 0; i < tags.size(); i++) {
             TagInfo tag = tags.get(i);
 
             List<TagInfo> tagList = map.get(tag.tag);
-            if (tagList == null)
-            {
+            if (tagList == null) {
                 tagList = new ArrayList<TagInfo>();
                 map.put(tag.tag, tagList);
             }
@@ -632,13 +571,14 @@ public class TiffField implements TiffCo
         return map;
     }
 
-    private static final Map<Object, List<TagInfo>> GPS_TAG_MAP = makeTagMap(GpsTagConstants.ALL_GPS_TAGS, false,
-            "GPS");
-    private static final Map<Object, List<TagInfo>> TIFF_TAG_MAP = makeTagMap(TiffTagConstants.ALL_TIFF_TAGS, false,
-            "TIFF");
-    private static final Map<Object, List<TagInfo>> EXIF_TAG_MAP = makeTagMap(ExifTagConstants.ALL_EXIF_TAGS, true,
-            "EXIF");
-    private static final Map<Object, List<TagInfo>> ALL_TAG_MAP = makeTagMap(ALL_TAGS, true, "All");
+    private static final Map<Object, List<TagInfo>> GPS_TAG_MAP = makeTagMap(
+            GpsTagConstants.ALL_GPS_TAGS, false, "GPS");
+    private static final Map<Object, List<TagInfo>> TIFF_TAG_MAP = makeTagMap(
+            TiffTagConstants.ALL_TIFF_TAGS, false, "TIFF");
+    private static final Map<Object, List<TagInfo>> EXIF_TAG_MAP = makeTagMap(
+            ExifTagConstants.ALL_EXIF_TAGS, true, "EXIF");
+    private static final Map<Object, List<TagInfo>> ALL_TAG_MAP = makeTagMap(
+            ALL_TAGS, true, "All");
 
     // static
     // {
@@ -667,16 +607,14 @@ public class TiffField implements TiffCo
     //
     //
 
-    public int[] getIntArrayValue() throws ImageReadException
-    {
+    public int[] getIntArrayValue() throws ImageReadException {
         Object o = getValue();
         // if (o == null)
         // return null;
 
         if (o instanceof Number)
             return new int[] { ((Number) o).intValue() };
-        else if (o instanceof Number[])
-        {
+        else if (o instanceof Number[]) {
             Number numbers[] = (Number[]) o;
             int result[] = new int[numbers.length];
             for (int i = 0; i < numbers.length; i++)
@@ -688,8 +626,7 @@ public class TiffField implements TiffCo
             for (int i = 0; i < numbers.length; i++)
                 result[i] = 0xffff & numbers[i];
             return result;
-        } else if (o instanceof int[])
-        {
+        } else if (o instanceof int[]) {
             int numbers[] = (int[]) o;
             int result[] = new int[numbers.length];
             for (int i = 0; i < numbers.length; i++)
@@ -702,17 +639,14 @@ public class TiffField implements TiffCo
         // return null;
     }
 
-    public double[] getDoubleArrayValue() throws ImageReadException
-    {
+    public double[] getDoubleArrayValue() throws ImageReadException {
         Object o = getValue();
         // if (o == null)
         // return null;
 
-        if (o instanceof Number)
-        {
+        if (o instanceof Number) {
             return new double[] { ((Number) o).doubleValue() };
-        } else if (o instanceof Number[])
-        {
+        } else if (o instanceof Number[]) {
             Number numbers[] = (Number[]) o;
             double result[] = new double[numbers.length];
             for (int i = 0; i < numbers.length; i++)
@@ -724,22 +658,19 @@ public class TiffField implements TiffCo
             for (int i = 0; i < numbers.length; i++)
                 result[i] = numbers[i];
             return result;
-        } else if (o instanceof int[])
-        {
+        } else if (o instanceof int[]) {
             int numbers[] = (int[]) o;
             double result[] = new double[numbers.length];
             for (int i = 0; i < numbers.length; i++)
                 result[i] = numbers[i];
             return result;
-        } else if (o instanceof float[])
-        {
+        } else if (o instanceof float[]) {
             float numbers[] = (float[]) o;
             double result[] = new double[numbers.length];
             for (int i = 0; i < numbers.length; i++)
                 result[i] = numbers[i];
             return result;
-        } else if (o instanceof double[])
-        {
+        } else if (o instanceof double[]) {
             double numbers[] = (double[]) o;
             double result[] = new double[numbers.length];
             for (int i = 0; i < numbers.length; i++)
@@ -752,8 +683,7 @@ public class TiffField implements TiffCo
         // return null;
     }
 
-    public int getIntValueOrArraySum() throws ImageReadException
-    {
+    public int getIntValueOrArraySum() throws ImageReadException {
         Object o = getValue();
         // if (o == null)
         // return -1;
@@ -785,8 +715,7 @@ public class TiffField implements TiffCo
         // return -1;
     }
 
-    public int getIntValue() throws ImageReadException
-    {
+    public int getIntValue() throws ImageReadException {
         Object o = getValue();
         if (o == null)
             throw new ImageReadException("Missing value: "
@@ -795,8 +724,7 @@ public class TiffField implements TiffCo
         return ((Number) o).intValue();
     }
 
-    public double getDoubleValue() throws ImageReadException
-    {
+    public double getDoubleValue() throws ImageReadException {
         Object o = getValue();
         if (o == null)
             throw new ImageReadException("Missing value: "
@@ -805,18 +733,15 @@ public class TiffField implements TiffCo
         return ((Number) o).doubleValue();
     }
 
-    public byte[] getByteArrayValue()
-    {
+    public byte[] getByteArrayValue() {
         return fieldType.getRawBytes(this);
     }
 
-    public int getSortHint()
-    {
+    public int getSortHint() {
         return sortHint;
     }
 
-    public void setSortHint(int sortHint)
-    {
+    public void setSortHint(int sortHint) {
         this.sortHint = sortHint;
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffHeader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffHeader.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffHeader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffHeader.java Sat May 26 21:19:03 2012
@@ -18,14 +18,12 @@ package org.apache.commons.imaging.forma
 
 import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
 
-public class TiffHeader extends TiffElement
-{
+public class TiffHeader extends TiffElement {
     public final int byteOrder;
     public final int tiffVersion;
     public final int offsetToFirstIFD;
 
-    public TiffHeader(final int byteOrder, int tiffVersion, int offsetToFirstIFD)
-    {
+    public TiffHeader(final int byteOrder, int tiffVersion, int offsetToFirstIFD) {
         super(0, TiffConstants.TIFF_HEADER_SIZE);
 
         this.byteOrder = byteOrder;
@@ -34,11 +32,10 @@ public class TiffHeader extends TiffElem
     }
 
     @Override
-    public String getElementDescription(boolean verbose)
-    {
+    public String getElementDescription(boolean verbose) {
         if (verbose)
             return null;
 
         return "TIFF Header";
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java Sat May 26 21:19:03 2012
@@ -26,32 +26,27 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.tiff.datareaders.DataReaderTiled;
 import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreter;
 
-public abstract class TiffImageData
-{
-    public static class Tiles extends TiffImageData
-    {
+public abstract class TiffImageData {
+    public static class Tiles extends TiffImageData {
         public final TiffElement.DataElement tiles[];
 
-        //        public final byte tiles[][];
+        // public final byte tiles[][];
         private final int tileWidth, tileLength;
 
         public Tiles(final TiffElement.DataElement tiles[],
-                final int tileWidth, final int tileLength)
-        {
+                final int tileWidth, final int tileLength) {
             this.tiles = tiles;
             this.tileWidth = tileWidth;
             this.tileLength = tileLength;
         }
 
         @Override
-        public TiffElement.DataElement[] getImageData()
-        {
+        public TiffElement.DataElement[] getImageData() {
             return tiles;
         }
 
         @Override
-        public boolean stripsNotTiles()
-        {
+        public boolean stripsNotTiles() {
             return false;
         }
 
@@ -59,42 +54,38 @@ public abstract class TiffImageData
         public DataReader getDataReader(TiffDirectory directory,
                 PhotometricInterpreter photometricInterpreter,
                 int bitsPerPixel, int bitsPerSample[], int predictor,
-                int samplesPerPixel, int width, int height, int compression, int byteOrder)
-                throws IOException, ImageReadException
-        {
+                int samplesPerPixel, int width, int height, int compression,
+                int byteOrder) throws IOException, ImageReadException {
             return new DataReaderTiled(directory, photometricInterpreter,
                     tileWidth, tileLength, bitsPerPixel, bitsPerSample,
-                    predictor, samplesPerPixel, width, height, compression, byteOrder, this);
+                    predictor, samplesPerPixel, width, height, compression,
+                    byteOrder, this);
         }
 
-        //        public TiffElement[] getElements()
-        //        {
-        //            return tiles;
-        //        }
+        // public TiffElement[] getElements()
+        // {
+        // return tiles;
+        // }
     }
 
-    public static class Strips extends TiffImageData
-    {
+    public static class Strips extends TiffImageData {
         public final TiffElement.DataElement strips[];
-        //        public final byte strips[][];
+        // public final byte strips[][];
         public final int rowsPerStrip;
 
         public Strips(final TiffElement.DataElement strips[],
-                final int rowsPerStrip)
-        {
+                final int rowsPerStrip) {
             this.strips = strips;
             this.rowsPerStrip = rowsPerStrip;
         }
 
         @Override
-        public TiffElement.DataElement[] getImageData()
-        {
+        public TiffElement.DataElement[] getImageData() {
             return strips;
         }
 
         @Override
-        public boolean stripsNotTiles()
-        {
+        public boolean stripsNotTiles() {
             return true;
         }
 
@@ -102,22 +93,21 @@ public abstract class TiffImageData
         public DataReader getDataReader(TiffDirectory directory,
                 PhotometricInterpreter photometricInterpreter,
                 int bitsPerPixel, int bitsPerSample[], int predictor,
-                int samplesPerPixel, int width, int height, int compression, int byteorder)
-                throws IOException, ImageReadException
-        {
+                int samplesPerPixel, int width, int height, int compression,
+                int byteorder) throws IOException, ImageReadException {
             return new DataReaderStrips(directory, photometricInterpreter,
                     bitsPerPixel, bitsPerSample, predictor, samplesPerPixel,
-                    width, height, compression,byteorder, rowsPerStrip, this);
+                    width, height, compression, byteorder, rowsPerStrip, this);
         }
 
-        //        public TiffElement[] getElements()
-        //        {
-        //            return strips;
-        //        }
+        // public TiffElement[] getElements()
+        // {
+        // return strips;
+        // }
 
     }
 
-    //    public abstract TiffElement[] getElements();
+    // public abstract TiffElement[] getElements();
 
     public abstract TiffElement.DataElement[] getImageData();
 
@@ -126,41 +116,35 @@ public abstract class TiffImageData
     public abstract DataReader getDataReader(TiffDirectory directory,
             PhotometricInterpreter photometricInterpreter, int bitsPerPixel,
             int bitsPerSample[], int predictor, int samplesPerPixel, int width,
-            int height, int compression, int byteOrder) throws IOException, ImageReadException;
+            int height, int compression, int byteOrder) throws IOException,
+            ImageReadException;
 
-    public static class Data extends TiffElement.DataElement
-    {
-        public Data(int offset, int length, final byte data[])
-        {
+    public static class Data extends TiffElement.DataElement {
+        public Data(int offset, int length, final byte data[]) {
             super(offset, length, data);
         }
 
         @Override
-        public String getElementDescription(boolean verbose)
-        {
+        public String getElementDescription(boolean verbose) {
             return "Tiff image data: " + data.length + " bytes";
         }
 
     }
-    
-    public static class ByteSourceData extends Data
-    {
-        ByteSourceFile byteSourceFile ;
-        public ByteSourceData(int offset, int length, ByteSourceFile byteSource)
-        {
+
+    public static class ByteSourceData extends Data {
+        ByteSourceFile byteSourceFile;
+
+        public ByteSourceData(int offset, int length, ByteSourceFile byteSource) {
             super(offset, length, new byte[0]);
             byteSourceFile = byteSource;
         }
 
         @Override
-        public String getElementDescription(boolean verbose)
-        {
+        public String getElementDescription(boolean verbose) {
             return "Tiff image data: " + data.length + " bytes";
         }
 
-        
-        public byte[] getData()
-        {
+        public byte[] getData() {
             try {
                 return byteSourceFile.getBlock(offset, length);
             } catch (IOException ioex) {
@@ -168,4 +152,4 @@ public abstract class TiffImageData
             return new byte[0];
         }
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java Sat May 26 21:19:03 2012
@@ -50,24 +50,19 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.tiff.write.TiffOutputField;
 import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet;
 
-public class TiffImageMetadata extends ImageMetadata
-        implements
-            TiffDirectoryConstants
-{
+public class TiffImageMetadata extends ImageMetadata implements
+        TiffDirectoryConstants {
     public final TiffContents contents;
     private static final Map<Object, Integer> tagCounts = countTags(AllTagConstants.ALL_TAGS);
 
-    public TiffImageMetadata(final TiffContents contents)
-    {
+    public TiffImageMetadata(final TiffContents contents) {
         this.contents = contents;
     }
 
-    private static final Map<Object, Integer> countTags(List<TagInfo> tags)
-    {
+    private static final Map<Object, Integer> countTags(List<TagInfo> tags) {
         Map<Object, Integer> map = new Hashtable<Object, Integer>();
 
-        for (int i = 0; i < tags.size(); i++)
-        {
+        for (int i = 0; i < tags.size(); i++) {
             TagInfo tag = tags.get(i);
 
             Integer count = map.get(tag.tag);
@@ -80,56 +75,48 @@ public class TiffImageMetadata extends I
         return map;
     }
 
-    public static class Directory extends ImageMetadata implements ImageMetadata.IImageMetadataItem
-    {
-        //        private BufferedImage thumbnail = null;
+    public static class Directory extends ImageMetadata implements
+            ImageMetadata.IImageMetadataItem {
+        // private BufferedImage thumbnail = null;
 
         public final int type;
 
         private final TiffDirectory directory;
         private final int byteOrder;
 
-        public Directory(int byteOrder, final TiffDirectory directory)
-        {
+        public Directory(int byteOrder, final TiffDirectory directory) {
             this.type = directory.type;
             this.directory = directory;
             this.byteOrder = byteOrder;
         }
 
-        public void add(TiffField entry)
-        {
+        public void add(TiffField entry) {
             add(new TiffImageMetadata.Item(entry));
         }
 
         public BufferedImage getThumbnail() throws ImageReadException,
-                IOException
-        {
+                IOException {
             return directory.getTiffImage(byteOrder);
         }
 
-        public TiffImageData getTiffImageData()
-        {
+        public TiffImageData getTiffImageData() {
             return directory.getTiffImageData();
         }
 
-        public TiffField findField(TagInfo tagInfo) throws ImageReadException
-        {
+        public TiffField findField(TagInfo tagInfo) throws ImageReadException {
             return directory.findField(tagInfo);
         }
 
-        public List<TiffField> getAllFields()
-        {
+        public List<TiffField> getAllFields() {
             return directory.getDirectoryEntrys();
         }
 
-        public JpegImageData getJpegImageData()
-        {
+        public JpegImageData getJpegImageData() {
             return directory.getJpegImageData();
         }
 
         @Override
-        public String toString(String prefix)
-        {
+        public String toString(String prefix) {
             return (prefix != null ? prefix : "") + directory.description()
                     + ": " //
                     + (getTiffImageData() != null ? " (tiffImageData)" : "") //
@@ -138,48 +125,43 @@ public class TiffImageMetadata extends I
         }
 
         public TiffOutputDirectory getOutputDirectory(int byteOrder)
-                throws ImageWriteException
-        {
-            try
-            {
-                TiffOutputDirectory dstDir = new TiffOutputDirectory(type, byteOrder);
+                throws ImageWriteException {
+            try {
+                TiffOutputDirectory dstDir = new TiffOutputDirectory(type,
+                        byteOrder);
 
                 List<? extends IImageMetadataItem> entries = getItems();
-                for (int i = 0; i < entries.size(); i++)
-                {
+                for (int i = 0; i < entries.size(); i++) {
                     TiffImageMetadata.Item item = (TiffImageMetadata.Item) entries
                             .get(i);
                     TiffField srcField = item.getTiffField();
 
-                    if (null != dstDir.findField(srcField.tag))
-                    {
+                    if (null != dstDir.findField(srcField.tag)) {
                         // ignore duplicate tags in a directory.
                         continue;
-                    }
-                    else if (srcField.tagInfo.isOffset())
-                    {
+                    } else if (srcField.tagInfo.isOffset()) {
                         // ignore offset fields.
                         continue;
                     }
 
                     TagInfo tagInfo = srcField.tagInfo;
                     FieldType fieldType = srcField.fieldType;
-                    //            byte bytes[] = srcField.fieldType.getRawBytes(srcField);
+                    // byte bytes[] = srcField.fieldType.getRawBytes(srcField);
 
-                    //                    Debug.debug("tagInfo", tagInfo);
+                    // Debug.debug("tagInfo", tagInfo);
 
                     Object value = srcField.getValue();
 
-                    //                    Debug.debug("value", Debug.getType(value));
+                    // Debug.debug("value", Debug.getType(value));
 
                     byte bytes[] = tagInfo.encodeValue(fieldType, value,
                             byteOrder);
 
-                    //                    if (tagInfo.isUnknown())
-                    //                        Debug.debug(
-                    //                                "\t" + "unknown tag(0x"
-                    //                                        + Integer.toHexString(srcField.tag)
-                    //                                        + ") bytes", bytes);
+                    // if (tagInfo.isUnknown())
+                    // Debug.debug(
+                    // "\t" + "unknown tag(0x"
+                    // + Integer.toHexString(srcField.tag)
+                    // + ") bytes", bytes);
 
                     int count = bytes.length / fieldType.length;
                     TiffOutputField dstField = new TiffOutputField(
@@ -192,28 +174,23 @@ public class TiffImageMetadata extends I
                 dstDir.setJpegImageData(getJpegImageData());
 
                 return dstDir;
-            }
-            catch (ImageReadException e)
-            {
+            } catch (ImageReadException e) {
                 throw new ImageWriteException(e.getMessage(), e);
             }
         }
 
     }
 
-    public List<? extends IImageMetadataItem> getDirectories()
-    {
+    public List<? extends IImageMetadataItem> getDirectories() {
         return super.getItems();
     }
 
     @Override
-    public List<? extends IImageMetadataItem> getItems()
-    {
+    public List<? extends IImageMetadataItem> getItems() {
         List<IImageMetadataItem> result = new ArrayList<IImageMetadataItem>();
 
         List<? extends IImageMetadataItem> items = super.getItems();
-        for (int i = 0; i < items.size(); i++)
-        {
+        for (int i = 0; i < items.size(); i++) {
             Directory dir = (Directory) items.get(i);
             result.addAll(dir.getItems());
         }
@@ -221,37 +198,31 @@ public class TiffImageMetadata extends I
         return result;
     }
 
-    public static class Item extends ImageMetadata.Item
-    {
+    public static class Item extends ImageMetadata.Item {
         private final TiffField entry;
 
-        public Item(TiffField entry)
-        {
-            //            super(entry.getTagName() + " (" + entry.getFieldTypeName() + ")",
+        public Item(TiffField entry) {
+            // super(entry.getTagName() + " (" + entry.getFieldTypeName() + ")",
             super(entry.getTagName(), entry.getValueDescription());
             this.entry = entry;
         }
 
-        public TiffField getTiffField()
-        {
+        public TiffField getTiffField() {
             return entry;
         }
 
     }
 
-    public TiffOutputSet getOutputSet() throws ImageWriteException
-    {
+    public TiffOutputSet getOutputSet() throws ImageWriteException {
         int byteOrder = contents.header.byteOrder;
         TiffOutputSet result = new TiffOutputSet(byteOrder);
 
         List<? extends IImageMetadataItem> srcDirs = getDirectories();
-        for (int i = 0; i < srcDirs.size(); i++)
-        {
+        for (int i = 0; i < srcDirs.size(); i++) {
             TiffImageMetadata.Directory srcDir = (TiffImageMetadata.Directory) srcDirs
                     .get(i);
 
-            if (null != result.findDirectory(srcDir.type))
-            {
+            if (null != result.findDirectory(srcDir.type)) {
                 // Certain cameras right directories more than once.
                 // This is a bug.
                 // Ignore second directory of a given type.
@@ -266,22 +237,20 @@ public class TiffImageMetadata extends I
         return result;
     }
 
-    public TiffField findField(TagInfo tagInfo) throws ImageReadException
-    {
+    public TiffField findField(TagInfo tagInfo) throws ImageReadException {
         return findField(tagInfo, false);
     }
 
-    public TiffField findField(TagInfo tagInfo, boolean exactDirectoryMatch) throws ImageReadException
-    {
+    public TiffField findField(TagInfo tagInfo, boolean exactDirectoryMatch)
+            throws ImageReadException {
         // Please keep this method in sync with TiffField's getTag()
         Integer tagCount = tagCounts.get(tagInfo.tag);
         int tagsMatching = tagCount == null ? 0 : tagCount.intValue();
 
         List<? extends IImageMetadataItem> directories = getDirectories();
-        if (exactDirectoryMatch || tagInfo.directoryType != TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN)
-        {
-            for (int i = 0; i < directories.size(); i++)
-            {
+        if (exactDirectoryMatch
+                || tagInfo.directoryType != TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN) {
+            for (int i = 0; i < directories.size(); i++) {
                 Directory directory = (Directory) directories.get(i);
                 if (directory.type == tagInfo.directoryType.directoryType) {
                     TiffField field = directory.findField(tagInfo);
@@ -293,17 +262,16 @@ public class TiffImageMetadata extends I
             if (exactDirectoryMatch || tagsMatching > 1) {
                 return null;
             }
-            for (int i = 0; i < directories.size(); i++)
-            {
+            for (int i = 0; i < directories.size(); i++) {
                 Directory directory = (Directory) directories.get(i);
-                if (tagInfo.directoryType.isImageDirectory() &&
-                        directory.type >= 0) {
+                if (tagInfo.directoryType.isImageDirectory()
+                        && directory.type >= 0) {
                     TiffField field = directory.findField(tagInfo);
                     if (field != null) {
                         return field;
                     }
-                } else if (!tagInfo.directoryType.isImageDirectory() &&
-                        directory.type < 0) {
+                } else if (!tagInfo.directoryType.isImageDirectory()
+                        && directory.type < 0) {
                     TiffField field = directory.findField(tagInfo);
                     if (field != null) {
                         return field;
@@ -312,8 +280,7 @@ public class TiffImageMetadata extends I
             }
         }
 
-        for (int i = 0; i < directories.size(); i++)
-        {
+        for (int i = 0; i < directories.size(); i++) {
             Directory directory = (Directory) directories.get(i);
             TiffField field = directory.findField(tagInfo);
             if (field != null) {
@@ -323,7 +290,7 @@ public class TiffImageMetadata extends I
 
         return null;
     }
-    
+
     public Object getFieldValue(TagInfo tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -331,7 +298,7 @@ public class TiffImageMetadata extends I
         }
         return field.getValue();
     }
-    
+
     public byte[] getFieldValue(TagInfoByte tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -342,7 +309,7 @@ public class TiffImageMetadata extends I
         }
         return field.fieldType.getRawBytes(field);
     }
-    
+
     public String[] getFieldValue(TagInfoAscii tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -354,7 +321,7 @@ public class TiffImageMetadata extends I
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
+
     public short[] getFieldValue(TagInfoShort tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -366,7 +333,7 @@ public class TiffImageMetadata extends I
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
+
     public int[] getFieldValue(TagInfoLong tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -378,8 +345,9 @@ public class TiffImageMetadata extends I
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
-    public RationalNumber[] getFieldValue(TagInfoRational tag) throws ImageReadException {
+
+    public RationalNumber[] getFieldValue(TagInfoRational tag)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             return null;
@@ -390,7 +358,7 @@ public class TiffImageMetadata extends I
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
+
     public byte[] getFieldValue(TagInfoSByte tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -401,7 +369,7 @@ public class TiffImageMetadata extends I
         }
         return field.fieldType.getRawBytes(field);
     }
-    
+
     public short[] getFieldValue(TagInfoSShort tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -413,7 +381,7 @@ public class TiffImageMetadata extends I
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
+
     public int[] getFieldValue(TagInfoSLong tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -425,8 +393,9 @@ public class TiffImageMetadata extends I
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
-    public RationalNumber[] getFieldValue(TagInfoSRational tag) throws ImageReadException {
+
+    public RationalNumber[] getFieldValue(TagInfoSRational tag)
+            throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
             return null;
@@ -437,7 +406,7 @@ public class TiffImageMetadata extends I
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
+
     public float[] getFieldValue(TagInfoFloat tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -449,7 +418,7 @@ public class TiffImageMetadata extends I
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
+
     public double[] getFieldValue(TagInfoDouble tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -461,7 +430,7 @@ public class TiffImageMetadata extends I
         byte[] bytes = field.fieldType.getRawBytes(field);
         return tag.getValue(field.byteOrder, bytes);
     }
-    
+
     public String getFieldValue(TagInfoGpsText tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -469,7 +438,7 @@ public class TiffImageMetadata extends I
         }
         return tag.getValue(field);
     }
-    
+
     public String getFieldValue(TagInfoXpString tag) throws ImageReadException {
         TiffField field = findField(tag);
         if (field == null) {
@@ -478,11 +447,9 @@ public class TiffImageMetadata extends I
         return tag.getValue(field);
     }
 
-    public TiffDirectory findDirectory(int directoryType)
-    {
+    public TiffDirectory findDirectory(int directoryType) {
         List<? extends IImageMetadataItem> directories = getDirectories();
-        for (int i = 0; i < directories.size(); i++)
-        {
+        for (int i = 0; i < directories.size(); i++) {
             Directory directory = (Directory) directories.get(i);
             if (directory.type == directoryType)
                 return directory.directory;
@@ -490,20 +457,17 @@ public class TiffImageMetadata extends I
         return null;
     }
 
-    public List<TiffField> getAllFields()
-    {
+    public List<TiffField> getAllFields() {
         List<TiffField> result = new ArrayList<TiffField>();
         List<? extends IImageMetadataItem> directories = getDirectories();
-        for (int i = 0; i < directories.size(); i++)
-        {
+        for (int i = 0; i < directories.size(); i++) {
             Directory directory = (Directory) directories.get(i);
             result.addAll(directory.getAllFields());
         }
         return result;
     }
 
-    public GPSInfo getGPS() throws ImageReadException
-    {
+    public GPSInfo getGPS() throws ImageReadException {
         TiffDirectory gpsDirectory = findDirectory(DIRECTORY_TYPE_GPS);
         if (null == gpsDirectory)
             return null;
@@ -546,8 +510,7 @@ public class TiffImageMetadata extends I
                 longitudeMinutes, longitudeSeconds);
     }
 
-    public static class GPSInfo
-    {
+    public static class GPSInfo {
         public final String latitudeRef;
         public final String longitudeRef;
 
@@ -564,8 +527,7 @@ public class TiffImageMetadata extends I
                 final RationalNumber latitudeSeconds,
                 final RationalNumber longitudeDegrees,
                 final RationalNumber longitudeMinutes,
-                final RationalNumber longitudeSeconds)
-        {
+                final RationalNumber longitudeSeconds) {
             this.latitudeRef = latitudeRef;
             this.longitudeRef = longitudeRef;
             this.latitudeDegrees = latitudeDegrees;
@@ -577,8 +539,7 @@ public class TiffImageMetadata extends I
         }
 
         @Override
-        public String toString()
-        {
+        public String toString() {
             // This will format the gps info like so:
             //
             // latitude: 8 degrees, 40 minutes, 42.2 seconds S
@@ -599,8 +560,7 @@ public class TiffImageMetadata extends I
             return result.toString();
         }
 
-        public double getLongitudeAsDegreesEast() throws ImageReadException
-        {
+        public double getLongitudeAsDegreesEast() throws ImageReadException {
             double result = longitudeDegrees.doubleValue()
                     + (longitudeMinutes.doubleValue() / 60.0)
                     + (longitudeSeconds.doubleValue() / 3600.0);
@@ -614,8 +574,7 @@ public class TiffImageMetadata extends I
                         + longitudeRef + "\"");
         }
 
-        public double getLatitudeAsDegreesNorth() throws ImageReadException
-        {
+        public double getLatitudeAsDegreesNorth() throws ImageReadException {
             double result = latitudeDegrees.doubleValue()
                     + (latitudeMinutes.doubleValue() / 60.0)
                     + (latitudeSeconds.doubleValue() / 3600.0);
@@ -631,4 +590,4 @@ public class TiffImageMetadata extends I
 
     }
 
-}
\ No newline at end of file
+}



Mime
View raw message