commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1245871 [3/5] - in /commons/proper/sanselan/trunk: ./ src/main/java/org/apache/commons/sanselan/common/ src/main/java/org/apache/commons/sanselan/formats/jpeg/ src/main/java/org/apache/commons/sanselan/formats/tiff/ src/main/java/org/apach...
Date Sat, 18 Feb 2012 06:43:35 GMT
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/GpsTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/GpsTagConstants.java?rev=1245871&r1=1245870&r2=1245871&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/GpsTagConstants.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/GpsTagConstants.java Sat Feb 18 06:43:33 2012
@@ -16,206 +16,220 @@
  */
 package org.apache.commons.sanselan.formats.tiff.constants;
 
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-public enum GpsTagConstants
-        implements
-            TiffDirectoryConstants,
-            TiffFieldTypeConstants,
-            TagHolder
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfo;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoAscii;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoByte;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoRational;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoShort;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoText;
+
+public interface GpsTagConstants
+        extends
+            TiffFieldTypeConstants
 {
-    GPS_VERSION_ID(new TagInfo(
-            "GPS Version ID", 0x0000, FIELD_TYPE_DESCRIPTION_BYTE, 4,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoByte GPS_TAG_GPS_VERSION_ID = new TagInfoByte(
+            "GPS Version ID", 0x0000, 4,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_LATITUDE_REF(new TagInfo(
-            "GPS Latitude Ref", 0x0001, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_LATITUDE_REF = new TagInfoAscii(
+            "GPS Latitude Ref", 0x0001, 2,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final String GPS_TAG_GPS_LATITUDE_REF_VALUE_NORTH = "N";
+    public static final String GPS_TAG_GPS_LATITUDE_REF_VALUE_SOUTH = "S";
     // ************************************************************
-    GPS_LATITUDE(new TagInfo(
-            "GPS Latitude", 0x0002, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoRational GPS_TAG_GPS_LATITUDE = new TagInfoRational(
+            "GPS Latitude", 0x0002, 3,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_LONGITUDE_REF(new TagInfo(
-            "GPS Longitude Ref", 0x0003, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_LONGITUDE_REF = new TagInfoAscii(
+            "GPS Longitude Ref", 0x0003, 2,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final String GPS_TAG_GPS_LONGITUDE_REF_VALUE_EAST = "E";
+    public static final String GPS_TAG_GPS_LONGITUDE_REF_VALUE_WEST = "W";
     // ************************************************************
-    GPS_LONGITUDE(new TagInfo(
-            "GPS Longitude", 0x0004, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoRational GPS_TAG_GPS_LONGITUDE = new TagInfoRational(
+            "GPS Longitude", 0x0004, 3,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_ALTITUDE_REF(new TagInfo(
-            "GPS Altitude Ref", 0x0005, FIELD_TYPE_DESCRIPTION_BYTE, 1,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoByte GPS_TAG_GPS_ALTITUDE_REF = new TagInfoByte(
+            "GPS Altitude Ref", 0x0005, 1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final int GPS_TAG_GPS_ALTITUDE_REF_VALUE_ABOVE_SEA_LEVEL = 0;
+    public static final int GPS_TAG_GPS_ALTITUDE_REF_VALUE_BELOW_SEA_LEVEL = 1;
     // ************************************************************
-    GPS_ALTITUDE(new TagInfo(
-            "GPS Altitude", 0x0006, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoRational GPS_TAG_GPS_ALTITUDE = new TagInfoRational(
+            "GPS Altitude", 0x0006, 1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_TIME_STAMP(new TagInfo(
-            "GPS Time Stamp", 0x0007, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoRational GPS_TAG_GPS_TIME_STAMP = new TagInfoRational(
+            "GPS Time Stamp", 0x0007, 3,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_SATELLITES(new TagInfo(
-            "GPS Satellites", 0x0008, FIELD_TYPE_DESCRIPTION_ASCII, -1,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_SATELLITES = new TagInfoAscii(
+            "GPS Satellites", 0x0008, -1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_STATUS(new TagInfo("GPS Status",
-            0x0009, FIELD_TYPE_DESCRIPTION_ASCII, 2, TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_STATUS = new TagInfoAscii(
+            "GPS Status", 0x0009, 2,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final String GPS_TAG_GPS_STATUS_VALUE_MEASUREMENT_IN_PROGRESS = "A";
+    public static final String GPS_TAG_GPS_STATUS_VALUE_MEASUREMENT_INTEROPERABILITY = "V";
     // ************************************************************
-    GPS_MEASURE_MODE(new TagInfo(
-            "GPS Measure Mode", 0x000a, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_MEASURE_MODE = new TagInfoAscii(
+            "GPS Measure Mode", 0x000a, 2,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final int GPS_TAG_GPS_MEASURE_MODE_VALUE_2_DIMENSIONAL_MEASUREMENT = 2;
+    public static final int GPS_TAG_GPS_MEASURE_MODE_VALUE_3_DIMENSIONAL_MEASUREMENT = 3;
     // ************************************************************
-    GPS_DOP(new TagInfo("GPS DOP",
-            0x000b, FIELD_TYPE_DESCRIPTION_RATIONAL, 1, TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoRational GPS_TAG_GPS_DOP = new TagInfoRational(
+            "GPS DOP", 0x000b, 1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_SPEED_REF(new TagInfo(
-            "GPS Speed Ref", 0x000c, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_SPEED_REF = new TagInfoAscii(
+            "GPS Speed Ref", 0x000c, 2,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final String GPS_TAG_GPS_SPEED_REF_VALUE_KMPH = "K";
+    public static final String GPS_TAG_GPS_SPEED_REF_VALUE_MPH = "M";
+    public static final String GPS_TAG_GPS_SPEED_REF_VALUE_KNOTS = "N";
     // ************************************************************
-    GPS_SPEED(new TagInfo("GPS Speed",
-            0x000d, FIELD_TYPE_DESCRIPTION_RATIONAL, 1, TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoRational GPS_TAG_GPS_SPEED = new TagInfoRational(
+            "GPS Speed", 0x000d, 1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_TRACK_REF(new TagInfo(
-            "GPS Track Ref", 0x000e, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_TRACK_REF = new TagInfoAscii(
+            "GPS Track Ref", 0x000e, 2,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final String GPS_TAG_GPS_TRACK_REF_VALUE_MAGNETIC_NORTH = "M";
+    public static final String GPS_TAG_GPS_TRACK_REF_VALUE_TRUE_NORTH = "T";
     // ************************************************************
-    GPS_TRACK(new TagInfo("GPS Track",
-            0x000f, FIELD_TYPE_DESCRIPTION_RATIONAL, 1, TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoRational GPS_TAG_GPS_TRACK = new TagInfoRational(
+            "GPS Track", 0x000f, 1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_IMG_DIRECTION_REF(new TagInfo(
-            "GPS Img Direction Ref", 0x0010, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_IMG_DIRECTION_REF = new TagInfoAscii(
+            "GPS Img Direction Ref", 0x0010, 2,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final String GPS_TAG_GPS_IMG_DIRECTION_REF_VALUE_MAGNETIC_NORTH = "M";
+    public static final String GPS_TAG_GPS_IMG_DIRECTION_REF_VALUE_TRUE_NORTH = "T";
     // ************************************************************
-    GPS_IMG_DIRECTION(new TagInfo(
-            "GPS Img Direction", 0x0011, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoRational GPS_TAG_GPS_IMG_DIRECTION = new TagInfoRational(
+            "GPS Img Direction", 0x0011, 1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_MAP_DATUM(new TagInfo(
-            "GPS Map Datum", 0x0012, FIELD_TYPE_DESCRIPTION_ASCII, -1,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_MAP_DATUM = new TagInfoAscii(
+            "GPS Map Datum", 0x0012, -1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_DEST_LATITUDE_REF(new TagInfo(
-            "GPS Dest Latitude Ref", 0x0013, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_DEST_LATITUDE_REF = new TagInfoAscii(
+            "GPS Dest Latitude Ref", 0x0013, 2,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final String GPS_TAG_GPS_DEST_LATITUDE_REF_VALUE_NORTH = "N";
+    public static final String GPS_TAG_GPS_DEST_LATITUDE_REF_VALUE_SOUTH = "S";
     // ************************************************************
-    GPS_DEST_LATITUDE(new TagInfo(
-            "GPS Dest Latitude", 0x0014, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoRational GPS_TAG_GPS_DEST_LATITUDE = new TagInfoRational(
+            "GPS Dest Latitude", 0x0014, 3,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_DEST_LONGITUDE_REF(new TagInfo(
-            "GPS Dest Longitude Ref", 0x0015, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_DEST_LONGITUDE_REF = new TagInfoAscii(
+            "GPS Dest Longitude Ref", 0x0015, 2,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final String GPS_TAG_GPS_DEST_LONGITUDE_REF_VALUE_EAST = "E";
+    public static final String GPS_TAG_GPS_DEST_LONGITUDE_REF_VALUE_WEST = "W";
     // ************************************************************
-    GPS_DEST_LONGITUDE(new TagInfo(
-            "GPS Dest Longitude", 0x0016, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoRational GPS_TAG_GPS_DEST_LONGITUDE = new TagInfoRational(
+            "GPS Dest Longitude", 0x0016, 3,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_DEST_BEARING_REF(new TagInfo(
-            "GPS Dest Bearing Ref", 0x0017, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_DEST_BEARING_REF = new TagInfoAscii(
+            "GPS Dest Bearing Ref", 0x0017, 2,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final String GPS_TAG_GPS_DEST_BEARING_REF_VALUE_MAGNETIC_NORTH = "M";
+    public static final String GPS_TAG_GPS_DEST_BEARING_REF_VALUE_TRUE_NORTH = "T";
     // ************************************************************
-    GPS_DEST_BEARING(new TagInfo(
-            "GPS Dest Bearing", 0x0018, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoRational GPS_TAG_GPS_DEST_BEARING = new TagInfoRational(
+            "GPS Dest Bearing", 0x0018, 1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_DEST_DISTANCE_REF(new TagInfo(
-            "GPS Dest Distance Ref", 0x0019, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_DEST_DISTANCE_REF = new TagInfoAscii(
+            "GPS Dest Distance Ref", 0x0019, 2,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final String GPS_TAG_GPS_DEST_DISTANCE_REF_VALUE_KILOMETERS = "K";
+    public static final String GPS_TAG_GPS_DEST_DISTANCE_REF_VALUE_MILES = "M";
+    public static final String GPS_TAG_GPS_DEST_DISTANCE_REF_VALUE_NAUTICAL_MILES = "N";
     // ************************************************************
-    GPS_DEST_DISTANCE(new TagInfo(
-            "GPS Dest Distance", 0x001a, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoRational GPS_TAG_GPS_DEST_DISTANCE = new TagInfoRational(
+            "GPS Dest Distance", 0x001a, 1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_PROCESSING_METHOD(new TagInfo.Text(
-            "GPS Processing Method", 0x001b, FIELD_TYPE_DESCRIPTION_UNKNOWN,
-            -1, TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoText GPS_TAG_GPS_PROCESSING_METHOD = new TagInfoText(
+            "GPS Processing Method", 0x001b, FIELD_TYPE_UNKNOWN,
+            -1, TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_AREA_INFORMATION(new TagInfo.Text(
-            "GPS Area Information", 0x001c, FIELD_TYPE_DESCRIPTION_UNKNOWN, -1,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoText GPS_TAG_GPS_AREA_INFORMATION = new TagInfoText(
+            "GPS Area Information", 0x001c, FIELD_TYPE_UNKNOWN, -1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_DATE_STAMP(new TagInfo(
-            "GPS Date Stamp", 0x001d, FIELD_TYPE_DESCRIPTION_ASCII, 11,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS)),
+    public static final TagInfoAscii GPS_TAG_GPS_DATE_STAMP = new TagInfoAscii(
+            "GPS Date Stamp", 0x001d, 11,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
-    GPS_DIFFERENTIAL(new TagInfo(
-            "GPS Differential", 0x001e, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.EXIF_DIRECTORY_GPS));
-    
-    public final TagInfo tagInfo;
-    
-    GpsTagConstants(TagInfo tagInfo) {
-        this.tagInfo = tagInfo;
-    }
-
-    public static final int GPS_DIFFERENTIAL_VALUE_NO_CORRECTION = 0;
-    public static final int GPS_DIFFERENTIAL_VALUE_DIFFERENTIAL_CORRECTED = 1;
-    public static final String GPS_LONGITUDE_REF_VALUE_EAST = "E";
-    public static final String GPS_LONGITUDE_REF_VALUE_WEST = "W";
-    public static final String GPS_LATITUDE_REF_VALUE_NORTH = "N";
-    public static final String GPS_LATITUDE_REF_VALUE_SOUTH = "S";
-    public static final int GPS_ALTITUDE_REF_VALUE_ABOVE_SEA_LEVEL = 0;
-    public static final int GPS_ALTITUDE_REF_VALUE_BELOW_SEA_LEVEL = 1;
-    public static final String GPS_STATUS_VALUE_MEASUREMENT_IN_PROGRESS = "A";
-    public static final String GPS_STATUS_VALUE_MEASUREMENT_INTEROPERABILITY = "V";
-    public static final int GPS_MEASURE_MODE_VALUE_2_DIMENSIONAL_MEASUREMENT = 2;
-    public static final int GPS_MEASURE_MODE_VALUE_3_DIMENSIONAL_MEASUREMENT = 3;
-    public static final String GPS_SPEED_REF_VALUE_KMPH = "K";
-    public static final String GPS_SPEED_REF_VALUE_MPH = "M";
-    public static final String GPS_SPEED_REF_VALUE_KNOTS = "N";
-    public static final String GPS_TRACK_REF_VALUE_MAGNETIC_NORTH = "M";
-    public static final String GPS_TRACK_REF_VALUE_TRUE_NORTH = "T";
-    public static final String GPS_IMG_DIRECTION_REF_VALUE_MAGNETIC_NORTH = "M";
-    public static final String GPS_IMG_DIRECTION_REF_VALUE_TRUE_NORTH = "T";
-    public static final String GPS_DEST_LATITUDE_REF_VALUE_NORTH = "N";
-    public static final String GPS_DEST_LATITUDE_REF_VALUE_SOUTH = "S";
-    public static final String GPS_DEST_LONGITUDE_REF_VALUE_EAST = "E";
-    public static final String GPS_DEST_LONGITUDE_REF_VALUE_WEST = "W";
-    public static final String GPS_DEST_BEARING_REF_VALUE_MAGNETIC_NORTH = "M";
-    public static final String GPS_DEST_BEARING_REF_VALUE_TRUE_NORTH = "T";
-    public static final String GPS_DEST_DISTANCE_REF_VALUE_KILOMETERS = "K";
-    public static final String GPS_DEST_DISTANCE_REF_VALUE_MILES = "M";
-    public static final String GPS_DEST_DISTANCE_REF_VALUE_NAUTICAL_MILES = "N";
+    public static final TagInfoShort GPS_TAG_GPS_DIFFERENTIAL = new TagInfoShort(
+            "GPS Differential", 0x001e, 1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
+    public static final int GPS_TAG_GPS_DIFFERENTIAL_VALUE_NO_CORRECTION = 0;
+    public static final int GPS_TAG_GPS_DIFFERENTIAL_VALUE_DIFFERENTIAL_CORRECTED = 1;
     // ************************************************************
 
-    public TagInfo getTagInfo() {
-        return tagInfo;
-    }
-    
-    public static final List<TagInfo> ALL_GPS_TAGS = Collections.unmodifiableList(
-            TagConstantsUtils.mergeTagLists(values()));
+    public static final List<TagInfo> ALL_GPS_TAGS =
+            Collections.unmodifiableList(Arrays.asList(
+                    GPS_TAG_GPS_VERSION_ID, GPS_TAG_GPS_LATITUDE_REF,
+                    GPS_TAG_GPS_LATITUDE, GPS_TAG_GPS_LONGITUDE_REF,
+                    GPS_TAG_GPS_LONGITUDE, GPS_TAG_GPS_ALTITUDE_REF,
+                    GPS_TAG_GPS_ALTITUDE, GPS_TAG_GPS_TIME_STAMP,
+                    GPS_TAG_GPS_SATELLITES, GPS_TAG_GPS_STATUS,
+                    GPS_TAG_GPS_MEASURE_MODE, GPS_TAG_GPS_DOP, GPS_TAG_GPS_SPEED_REF,
+                    GPS_TAG_GPS_SPEED, GPS_TAG_GPS_TRACK_REF, GPS_TAG_GPS_TRACK,
+                    GPS_TAG_GPS_IMG_DIRECTION_REF, GPS_TAG_GPS_IMG_DIRECTION,
+                    GPS_TAG_GPS_MAP_DATUM, GPS_TAG_GPS_DEST_LATITUDE_REF,
+                    GPS_TAG_GPS_DEST_LATITUDE, GPS_TAG_GPS_DEST_LONGITUDE_REF,
+                    GPS_TAG_GPS_DEST_LONGITUDE, GPS_TAG_GPS_DEST_BEARING_REF,
+                    GPS_TAG_GPS_DEST_BEARING, GPS_TAG_GPS_DEST_DISTANCE_REF,
+                    GPS_TAG_GPS_DEST_DISTANCE, GPS_TAG_GPS_PROCESSING_METHOD,
+                    GPS_TAG_GPS_AREA_INFORMATION, GPS_TAG_GPS_DATE_STAMP,
+                    GPS_TAG_GPS_DIFFERENTIAL));
 }

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TagConstantsUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TagConstantsUtils.java?rev=1245871&r1=1245870&r2=1245871&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TagConstantsUtils.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TagConstantsUtils.java Sat Feb 18 06:43:33 2012
@@ -19,22 +19,24 @@ package org.apache.commons.sanselan.form
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfo;
+
 public class TagConstantsUtils implements TiffDirectoryConstants
 {
     private static final TiffDirectoryType[] tiffDirectoryTypes = TiffDirectoryType.values();
 
-    public static List<TagInfo> mergeTagLists(TagHolder[]... tagHolders)
+    public static List<TagInfo> mergeTagLists(List<TagInfo>... tagLists)
     {
         int count = 0;
-        for (int i = 0; i < tagHolders.length; i++) {
-            count += tagHolders[i].length;
+        for (int i = 0; i < tagLists.length; i++) {
+            count += tagLists[i].size();
         }
 
         ArrayList<TagInfo> result = new ArrayList<TagInfo>(count);
 
-        for (int i = 0; i < tagHolders.length; i++) {
-            for (int j = 0; j < tagHolders[i].length; j++) {
-                result.add(tagHolders[i][j].getTagInfo());
+        for (int i = 0; i < tagLists.length; i++) {
+            for (int j = 0; j < tagLists[i].size(); j++) {
+                result.add(tagLists[i].get(j));
             }
         }
 

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TagInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TagInfo.java?rev=1245871&r1=1245870&r2=1245871&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TagInfo.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TagInfo.java Sat Feb 18 06:43:33 2012
@@ -1,447 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.sanselan.formats.tiff.constants;
-
-import java.io.UnsupportedEncodingException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-
-import org.apache.commons.sanselan.ImageReadException;
-import org.apache.commons.sanselan.ImageWriteException;
-import org.apache.commons.sanselan.common.BinaryFileFunctions;
-import org.apache.commons.sanselan.formats.tiff.TiffField;
-import org.apache.commons.sanselan.formats.tiff.fieldtypes.FieldType;
-import org.apache.commons.sanselan.util.Debug;
-
-public class TagInfo implements TiffDirectoryConstants, TiffFieldTypeConstants
-{
-    protected static final int LENGTH_UNKNOWN = -1;
-
-    public TagInfo(String name, int tag, FieldType dataType, int length,
-            TiffDirectoryType exifDirectory)
-    {
-        this(name, tag, new FieldType[]{
-            dataType
-        }, length, exifDirectory);
-    }
-
-    public TagInfo(String name, int tag, FieldType dataType, int length)
-    {
-        this(name, tag, new FieldType[]{
-            dataType
-        }, length, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
-    }
-
-    public TagInfo(String name, int tag, FieldType dataType,
-            String lengthDescription)
-    {
-        this(name, tag, new FieldType[]{
-            dataType
-        }, LENGTH_UNKNOWN, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
-    }
-
-    public TagInfo(String name, int tag, FieldType dataTypes[],
-            String lengthDescription)
-    {
-        this(name, tag, dataTypes, LENGTH_UNKNOWN, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
-    }
-
-    public TagInfo(String name, int tag, FieldType dataType)
-    {
-        this(name, tag, dataType, LENGTH_UNKNOWN, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
-    }
-
-    public TagInfo(String name, int tag, FieldType dataTypes[], int length,
-            String lengthDescription)
-    {
-        this(name, tag, dataTypes, length, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
-    }
-
-    public final String name;
-    public final int tag;
-    public final FieldType dataTypes[];
-    public final int length;
-    public final TiffDirectoryType directoryType;
-
-    //    public final String lengthDescription;
-
-    public TagInfo(String name, int tag, FieldType dataTypes[], int length,
-            TiffDirectoryType exifDirectory
-    //            , String lengthDescription
-    )
-    {
-        this.name = name;
-        this.tag = tag;
-        this.dataTypes = dataTypes;
-        this.length = length;
-        //        this.lengthDescription = lengthDescription;
-        this.directoryType = exifDirectory;
-    }
-
-    public Object getValue(TiffField entry) throws ImageReadException
-    {
-        Object o = entry.fieldType.getSimpleValue(entry);
-        return o;
-    }
-
-    public byte[] encodeValue(FieldType fieldType, Object value, int byteOrder)
-            throws ImageWriteException
-    {
-        return fieldType.writeData(value, byteOrder);
-    }
-
-    public String getDescription()
-    {
-        return tag + " (0x" + Integer.toHexString(tag) + ": " + name + "): ";
-    }
-
-    public String toString()
-    {
-        return "[TagInfo. tag: " + tag + " (0x" + Integer.toHexString(tag)
-                + ", name: " + name + "]";
-    }
-
-    public boolean isDate()
-    {
-        return false;
-    }
-
-    public boolean isOffset()
-    {
-        return false;
-    }
-
-    public boolean isText()
-    {
-        return false;
-    }
-
-    public boolean isUnknown()
-    {
-        return false;
-    }
-
-    public static class Offset extends TagInfo
-    {
-        public Offset(String name, int tag, FieldType dataTypes[], int length,
-                TiffDirectoryType exifDirectory)
-        {
-            super(name, tag, dataTypes, length, exifDirectory);
-        }
-
-        public Offset(String name, int tag, FieldType dataType, int length,
-                TiffDirectoryType exifDirectory)
-        {
-            super(name, tag, dataType, length, exifDirectory);
-        }
-
-        public Offset(String name, int tag, FieldType dataType, int length)
-        {
-            super(name, tag, dataType, length);
-        }
-
-        //        "Exif Offset", 0x8769, FIELD_TYPE_DESCRIPTION_UNKNOWN, 1,
-        //        EXIF_DIRECTORY_UNKNOWN);
-        public boolean isOffset()
-        {
-            return true;
-        }
-    }
-
-    public static class Date extends TagInfo
-    {
-        public Date(String name, int tag, FieldType dataType, int length)
-        {
-            super(name, tag, dataType, length);
-        }
-
-        private static final DateFormat DATE_FORMAT_1 = new SimpleDateFormat(
-                "yyyy:MM:dd HH:mm:ss");
-        private static final DateFormat DATE_FORMAT_2 = new SimpleDateFormat(
-                "yyyy:MM:dd:HH:mm:ss");
-
-        public Object getValue(TiffField entry) throws ImageReadException
-        {
-            Object o = entry.fieldType.getSimpleValue(entry);
-
-            String s = (String) o;
-            try
-            {
-                java.util.Date date = DATE_FORMAT_1.parse(s);
-                return date;
-            }
-            catch (Exception e)
-            {
-                //        Debug.debug(e);
-            }
-            try
-            {
-                java.util.Date date = DATE_FORMAT_2.parse(s);
-                return date;
-            }
-            catch (Exception e)
-            {
-                Debug.debug(e);
-            }
-
-            return o;
-        }
-
-        public byte[] encodeValue(FieldType fieldType, Object value,
-                int byteOrder) throws ImageWriteException
-        {
-            throw new ImageWriteException("date encode value: " + value + " ("
-                    + Debug.getType(value) + ")");
-            //            return fieldType.writeData(value, byteOrder);
-            //            Object o = entry.fieldType.getSimpleValue(entry);
-            //            byte bytes2[];
-            //            if (tagInfo.isDate())
-            //                bytes2 = fieldType.getRawBytes(srcField);
-            //            else
-            //                bytes2 = fieldType.writeData(value, byteOrder);
-            //            return o;
-        }
-
-        public String toString()
-        {
-            return "[TagInfo. tag: " + tag + ", name: " + name + " (data)"
-                    + "]";
-        }
-
-        // TODO: use polymorphism
-        public boolean isDate()
-        {
-            return true;
-        }
-
-    }
-
-    public static final class Text extends TagInfo
-    {
-        public Text(String name, int tag, FieldType dataType, int length,
-                TiffDirectoryType exifDirectory)
-        {
-            super(name, tag, dataType, length, exifDirectory);
-        }
-
-        public Text(String name, int tag, FieldType dataTypes[], int length,
-                TiffDirectoryType exifDirectory)
-        {
-            super(name, tag, dataTypes, length, exifDirectory);
-        }
-
-        public boolean isText()
-        {
-            return true;
-        }
-
-        private static final class TextEncoding
-        {
-            public final byte prefix[];
-            public final String encodingName;
-
-            public TextEncoding(final byte[] prefix, final String encodingName)
-            {
-                this.prefix = prefix;
-                this.encodingName = encodingName;
-            }
-        }
-
-        private static final TextEncoding TEXT_ENCODING_ASCII = new TextEncoding(
-                new byte[]{
-                        0x41, 0x53, 0x43, 0x49, 0x49, 0x00, 0x00, 0x00,
-                }, "US-ASCII"); // ITU-T T.50 IA5
-        private static final TextEncoding TEXT_ENCODING_JIS = new TextEncoding(
-                new byte[]{
-                        0x4A, 0x49, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00,
-                }, "JIS"); // JIS X208-1990
-        private static final TextEncoding TEXT_ENCODING_UNICODE = new TextEncoding(
-                new byte[]{
-                        0x55, 0x4E, 0x49, 0x43, 0x4F, 0x44, 0x45, 0x00,
-                // Which Unicode encoding to use, UTF-8?
-                }, "UTF-8"); // Unicode Standard
-        private static final TextEncoding TEXT_ENCODING_UNDEFINED = new TextEncoding(
-                new byte[]{
-                        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                // Try to interpret an undefined text as ISO-8859-1 (Latin)
-                }, "ISO-8859-1"); // Undefined
-        private static final TextEncoding TEXT_ENCODINGS[] = {
-                TEXT_ENCODING_ASCII, //
-                TEXT_ENCODING_JIS, //
-                TEXT_ENCODING_UNICODE, //
-                TEXT_ENCODING_UNDEFINED, //
-        };
-
-        public byte[] encodeValue(FieldType fieldType, Object value,
-                int byteOrder) throws ImageWriteException
-        {
-            if (!(value instanceof String))
-                throw new ImageWriteException("Text value not String: " + value
-                        + " (" + Debug.getType(value) + ")");
-            String s = (String) value;
-
-            try
-            {
-                // try ASCII, with NO prefix.
-                byte asciiBytes[] = s
-                        .getBytes(TEXT_ENCODING_ASCII.encodingName);
-                String decodedAscii = new String(asciiBytes,
-                        TEXT_ENCODING_ASCII.encodingName);
-                if (decodedAscii.equals(s))
-                {
-                    // no unicode/non-ascii values.
-                    byte result[] = new byte[asciiBytes.length
-                            + TEXT_ENCODING_ASCII.prefix.length];
-                    System.arraycopy(TEXT_ENCODING_ASCII.prefix, 0, result, 0,
-                            TEXT_ENCODING_ASCII.prefix.length);
-                    System.arraycopy(asciiBytes, 0, result,
-                            TEXT_ENCODING_ASCII.prefix.length,
-                            asciiBytes.length);
-                    return result;
-                }
-                else
-                {
-                    // use unicode
-                    byte unicodeBytes[] = s
-                            .getBytes(TEXT_ENCODING_UNICODE.encodingName);
-                    byte result[] = new byte[unicodeBytes.length
-                            + TEXT_ENCODING_UNICODE.prefix.length];
-                    System.arraycopy(TEXT_ENCODING_UNICODE.prefix, 0, result,
-                            0, TEXT_ENCODING_UNICODE.prefix.length);
-                    System.arraycopy(unicodeBytes, 0, result,
-                            TEXT_ENCODING_UNICODE.prefix.length,
-                            unicodeBytes.length);
-                    return result;
-                }
-            }
-            catch (UnsupportedEncodingException e)
-            {
-                throw new ImageWriteException(e.getMessage(), e);
-            }
-        }
-
-        public Object getValue(TiffField entry) throws ImageReadException
-        {
-            //            Debug.debug("entry.type", entry.type);
-            //            Debug.debug("entry.type", entry.getDescriptionWithoutValue());
-            //            Debug.debug("entry.type", entry.fieldType);
-
-            if (entry.type == FIELD_TYPE_ASCII.type)
-                return FIELD_TYPE_ASCII.getSimpleValue(entry);
-            else if (entry.type == FIELD_TYPE_UNDEFINED.type)
-            { /* do nothing */ }
-            else if (entry.type == FIELD_TYPE_BYTE.type)
-            { /* do nothing */ }
-            else
-            {
-                Debug.debug("entry.type", entry.type);
-                Debug.debug("entry.directoryType", entry.directoryType);
-                Debug.debug("entry.type", entry.getDescriptionWithoutValue());
-                Debug.debug("entry.type", entry.fieldType);
-                throw new ImageReadException("Text field not encoded as bytes.");
-            }
-
-            byte bytes[] = entry.fieldType.getRawBytes(entry);
-            if (bytes.length < 8)
-            {
-                try
-                {
-                    // try ASCII, with NO prefix.
-                    return new String(bytes, "US-ASCII");
-                }
-                catch (UnsupportedEncodingException e)
-                {
-                    throw new ImageReadException(
-                            "Text field missing encoding prefix.");
-                }
-            }
-
-            for (int i = 0; i < TEXT_ENCODINGS.length; i++)
-            {
-                TextEncoding encoding = TEXT_ENCODINGS[i];
-                if (BinaryFileFunctions.compareBytes(bytes, 0, encoding.prefix,
-                        0, encoding.prefix.length))
-                {
-                    try
-                    {
-                        //                        Debug.debug("encodingName", encoding.encodingName);
-                        return new String(bytes, encoding.prefix.length,
-                                bytes.length - encoding.prefix.length,
-                                encoding.encodingName);
-                    }
-                    catch (UnsupportedEncodingException e)
-                    {
-                        throw new ImageReadException(e.getMessage(), e);
-                    }
-                }
-            }
-
-            //                        Debug.debug("entry.tag", entry.tag + " (0x" + Integer.toHexString(entry.tag ) +")");
-            //                        Debug.debug("entry.type", entry.type);
-            //                        Debug.debug("bytes", bytes, 10);
-            //            throw new ImageReadException(
-            //                    "Unknown Text encoding prefix.");
-
-            try
-            {
-                // try ASCII, with NO prefix.
-                return new String(bytes, "US-ASCII");
-            }
-            catch (UnsupportedEncodingException e)
-            {
-                throw new ImageReadException("Unknown text encoding prefix.");
-            }
-
-        }
-    }
-
-    public static final class Unknown extends TagInfo
-    {
-
-        public Unknown(String name, int tag, FieldType dataTypes[], int length,
-                TiffDirectoryType exifDirectory)
-        {
-            super(name, tag, dataTypes, length, exifDirectory);
-        }
-
-        public boolean isUnknown()
-        {
-            return true;
-        }
-
-        public byte[] encodeValue(FieldType fieldType, Object value,
-                int byteOrder) throws ImageWriteException
-        {
-            //            Debug.debug();
-            //            Debug.debug("unknown tag(0x" + Integer.toHexString(tag) + ") ",
-            //                    this);
-            //            Debug.debug("unknown tag fieldType", fieldType);
-            //            Debug.debug("unknown tag value", value);
-            //            Debug.debug("unknown tag value", Debug.getType(value));
-            byte result[] = super.encodeValue(fieldType, value, byteOrder);
-            //            Debug.debug("unknown tag result", result);
-            return result;
-        }
-
-        public Object getValue(TiffField entry) throws ImageReadException
-        {
-            return super.getValue(entry);
-        }
-    }
-
-}
\ No newline at end of file

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TiffFieldTypeConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TiffFieldTypeConstants.java?rev=1245871&r1=1245870&r2=1245871&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TiffFieldTypeConstants.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TiffFieldTypeConstants.java Sat Feb 18 06:43:33 2012
@@ -16,6 +16,10 @@
  */
 package org.apache.commons.sanselan.formats.tiff.constants;
 
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
 import org.apache.commons.sanselan.SanselanConstants;
 import org.apache.commons.sanselan.formats.tiff.fieldtypes.FieldType;
 import org.apache.commons.sanselan.formats.tiff.fieldtypes.FieldTypeAscii;
@@ -64,40 +68,32 @@ public interface TiffFieldTypeConstants 
 
     public static final FieldType FIELD_TYPE_UNKNOWN = new FieldTypeUnknown();
 
-    public static final FieldType FIELD_TYPES[] = {
-            FIELD_TYPE_BYTE, FIELD_TYPE_ASCII, FIELD_TYPE_SHORT,
-            FIELD_TYPE_LONG, FIELD_TYPE_RATIONAL, FIELD_TYPE_SBYTE,
-            FIELD_TYPE_UNDEFINED, FIELD_TYPE_SSHORT, FIELD_TYPE_SLONG,
-            FIELD_TYPE_SRATIONAL, FIELD_TYPE_FLOAT, FIELD_TYPE_DOUBLE,
-    };
-
-    public static final FieldType FIELD_TYPE_ANY[] = FIELD_TYPES;
-
-    public static final FieldType FIELD_TYPE_DESCRIPTION_LONG[] = {
-        FIELD_TYPE_LONG,
-    };
-    public static final FieldType FIELD_TYPE_DESCRIPTION_SHORT[] = {
-        FIELD_TYPE_SHORT,
-    };
-    public static final FieldType FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG[] = {
-            FIELD_TYPE_SHORT, FIELD_TYPE_LONG,
-    };
-    public static final FieldType FIELD_TYPE_DESCRIPTION_ASCII[] = {
-        FIELD_TYPE_ASCII,
-    };
-    public static final FieldType FIELD_TYPE_DESCRIPTION_LONG_OR_SHORT[] = {
-            FIELD_TYPE_SHORT, FIELD_TYPE_LONG,
-    };
-    public static final FieldType FIELD_TYPE_DESCRIPTION_RATIONAL[] = {
-        FIELD_TYPE_RATIONAL,
-    };
-    public static final FieldType FIELD_TYPE_DESCRIPTION_BYTE_OR_SHORT[] = {
-            FIELD_TYPE_SHORT, FIELD_TYPE_BYTE
-    };
-    public static final FieldType FIELD_TYPE_DESCRIPTION_BYTE[] = {
-        FIELD_TYPE_BYTE,
-    };
-    public static final FieldType FIELD_TYPE_DESCRIPTION_ANY[] = FIELD_TYPE_ANY;
-    public static final FieldType FIELD_TYPE_DESCRIPTION_UNKNOWN[] = null;
-
+    public static final List<FieldType> FIELD_TYPES =
+            Collections.unmodifiableList(Arrays.asList(
+                    FIELD_TYPE_BYTE, FIELD_TYPE_ASCII, FIELD_TYPE_SHORT,
+                    FIELD_TYPE_LONG, FIELD_TYPE_RATIONAL, FIELD_TYPE_SBYTE,
+                    FIELD_TYPE_UNDEFINED, FIELD_TYPE_SSHORT, FIELD_TYPE_SLONG,
+                    FIELD_TYPE_SRATIONAL, FIELD_TYPE_FLOAT, FIELD_TYPE_DOUBLE));
+
+    public static final List<FieldType> FIELD_TYPE_ANY = FIELD_TYPES;
+
+    public static final List<FieldType> FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG =
+            Collections.unmodifiableList(Arrays.asList(
+                    FIELD_TYPE_SHORT, FIELD_TYPE_LONG));
+    
+    public static final List<FieldType> FIELD_TYPE_DESCRIPTION_SHORT_OR_RATIONAL =
+            Collections.unmodifiableList(Arrays.asList(
+                    FIELD_TYPE_SHORT, FIELD_TYPE_RATIONAL));
+    
+    public static final List<FieldType> FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG_OR_RATIONAL =
+            Collections.unmodifiableList(Arrays.asList(
+                    FIELD_TYPE_SHORT, FIELD_TYPE_LONG, FIELD_TYPE_RATIONAL));
+    
+    public static final List<FieldType> FIELD_TYPE_DESCRIPTION_LONG_OR_SHORT =
+            Collections.unmodifiableList(Arrays.asList(
+                    FIELD_TYPE_SHORT, FIELD_TYPE_LONG));
+    
+    public static final List<FieldType> FIELD_TYPE_DESCRIPTION_BYTE_OR_SHORT =
+            Collections.unmodifiableList(Arrays.asList(
+                    FIELD_TYPE_SHORT, FIELD_TYPE_BYTE));
 }
\ No newline at end of file

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TiffTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TiffTagConstants.java?rev=1245871&r1=1245870&r2=1245871&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TiffTagConstants.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TiffTagConstants.java Sat Feb 18 06:43:33 2012
@@ -16,308 +16,366 @@
  */
 package org.apache.commons.sanselan.formats.tiff.constants;
 
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-public enum TiffTagConstants implements TiffFieldTypeConstants, TagHolder
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfo;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoAny;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoAscii;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoByte;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoByteOrShort;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoLong;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoRational;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoShort;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoShortOrLong;
+import org.apache.commons.sanselan.formats.tiff.taginfos.TagInfoUnknown;
+
+public interface TiffTagConstants
+        extends
+            TiffFieldTypeConstants
 {
 
-    NEW_SUBFILE_TYPE(new TagInfo(
-            "New Subfile Type", 0xFE, FIELD_TYPE_DESCRIPTION_LONG, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
+    public static final TagInfoLong TIFF_TAG_NEW_SUBFILE_TYPE = new TagInfoLong(
+            "New Subfile Type", 0xFE, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_SUBFILE_TYPE = new TagInfoShort(
+            "Subfile Type", 0xFF, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShortOrLong TIFF_TAG_IMAGE_WIDTH = new TagInfoShortOrLong(
+            "Image Width", 0x100, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShortOrLong TIFF_TAG_IMAGE_LENGTH = new TagInfoShortOrLong(
+            "Image Length", 0x101, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_BITS_PER_SAMPLE = new TagInfoShort(
+            "Bits Per Sample", 0x102, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_COMPRESSION = new TagInfoShort(
+            "Compression", 0x103, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_PHOTOMETRIC_INTERPRETATION = new TagInfoShort(
+            "Photometric Interpretation", 0x106, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_THRESHHOLDING = new TagInfoShort(
+            "Threshholding", 0x107, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_CELL_WIDTH = new TagInfoShort(
+            "Cell Width", 0x108, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_CELL_LENGTH = new TagInfoShort(
+            "Cell Length", 0x109, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_FILL_ORDER = new TagInfoShort(
+            "Fill Order", 0x10A, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAscii TIFF_TAG_DOCUMENT_NAME = new TagInfoAscii(
+            "Document Name", 0x10D, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAscii TIFF_TAG_IMAGE_DESCRIPTION = new TagInfoAscii(
+            "Image Description", 0x10E, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAscii TIFF_TAG_MAKE = new TagInfoAscii(
+            "Make", 0x10F, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAscii TIFF_TAG_MODEL = new TagInfoAscii(
+            "Model", 0x110, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShortOrLong TIFF_TAG_STRIP_OFFSETS = new TagInfoShortOrLong(
+            "Strip Offsets", 0x111, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT, true);
+
+    public static final TagInfoShort TIFF_TAG_ORIENTATION = new TagInfoShort(
+            "Orientation", 0x112, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_SAMPLES_PER_PIXEL = new TagInfoShort(
+            "Samples Per Pixel", 0x115, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShortOrLong TIFF_TAG_ROWS_PER_STRIP = new TagInfoShortOrLong(
+            "Rows Per Strip", 0x116, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShortOrLong TIFF_TAG_STRIP_BYTE_COUNTS = new TagInfoShortOrLong(
+            "Strip Byte Counts", 0x117, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_MIN_SAMPLE_VALUE = new TagInfoShort(
+            "Min Sample Value", 0x118, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_MAX_SAMPLE_VALUE = new TagInfoShort(
+            "Max Sample Value", 0x119, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoRational TIFF_TAG_XRESOLUTION = new TagInfoRational(
+            "XResolution", 0x11A, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoRational TIFF_TAG_YRESOLUTION = new TagInfoRational(
+            "YResolution", 0x11B, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_PLANAR_CONFIGURATION = new TagInfoShort(
+            "Planar Configuration", 0x11C, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAscii TIFF_TAG_PAGE_NAME = new TagInfoAscii(
+            "Page Name", 0x11D, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoRational TIFF_TAG_XPOSITION = new TagInfoRational(
+            "XPosition", 0x11E, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoRational TIFF_TAG_YPOSITION = new TagInfoRational(
+            "YPosition",  0x11F, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoLong TIFF_TAG_FREE_OFFSETS = new TagInfoLong(
+            "Free Offsets", 0x120, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoLong TIFF_TAG_FREE_BYTE_COUNTS = new TagInfoLong(
+            "Free Byte Counts", 0x121, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_GRAY_RESPONSE_UNIT = new TagInfoShort(
+            "Gray Response Unit", 0x122, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_GRAY_RESPONSE_CURVE = new TagInfoShort(
+            "Gray Response Curve", 0x123, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoLong TIFF_TAG_T4_OPTIONS = new TagInfoLong(
+            "T4 Options", 0x124, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoLong TIFF_TAG_T6_OPTIONS = new TagInfoLong(
+            "T6 Options", 0x125, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_RESOLUTION_UNIT = new TagInfoShort(
+            "Resolution Unit", 0x128, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_PAGE_NUMBER = new TagInfoShort(
+            "Page Number", 0x129, 2,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_TRANSFER_FUNCTION = new TagInfoShort(
+            "Transfer Function", 0x12D, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAscii TIFF_TAG_SOFTWARE = new TagInfoAscii(
+            "Software", 0x131, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAscii TIFF_TAG_DATE_TIME = new TagInfoAscii(
+            "Date Time", 0x132, 20,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAscii TIFF_TAG_ARTIST = new TagInfoAscii(
+            "Artist", 0x13B, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAscii TIFF_TAG_HOST_COMPUTER = new TagInfoAscii(
+            "Host Computer", 0x13C, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_PREDICTOR = new TagInfoShort(
+            "Predictor", 0x13D, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoRational TIFF_TAG_WHITE_POINT = new TagInfoRational(
+            "White Point", 0x13E, 2,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoRational TIFF_TAG_PRIMARY_CHROMATICITIES = new TagInfoRational(
+            "Primary Chromaticities", 0x13F, 6,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_COLOR_MAP = new TagInfoShort(
+            "Color Map", 0x140, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_HALFTONE_HINTS = new TagInfoShort(
+            "Halftone Hints", 0x141, 2,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShortOrLong TIFF_TAG_TILE_WIDTH = new TagInfoShortOrLong(
+            "Tile Width", 0x142, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShortOrLong TIFF_TAG_TILE_LENGTH = new TagInfoShortOrLong(
+            "Tile Length", 0x143, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoLong TIFF_TAG_TILE_OFFSETS = new TagInfoLong(
+            "Tile Offsets", 0x144, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT, true);
+
+    public static final TagInfoShortOrLong TIFF_TAG_TILE_BYTE_COUNTS = new TagInfoShortOrLong(
+            "Tile Byte Counts", 0x145, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_INK_SET = new TagInfoShort(
+            "Ink Set", 0x14C, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAscii TIFF_TAG_INK_NAMES = new TagInfoAscii(
+            "Ink Names", 0x14D, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_NUMBER_OF_INKS = new TagInfoShort(
+            "Number Of Inks", 0x14E, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoByteOrShort TIFF_TAG_DOT_RANGE = new TagInfoByteOrShort(
+            "Dot Range", 0x150, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAscii TIFF_TAG_TARGET_PRINTER = new TagInfoAscii(
+            "Target Printer", 0x151, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_EXTRA_SAMPLES = new TagInfoShort(
+            "Extra Samples", 0x152, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_SAMPLE_FORMAT = new TagInfoShort(
+            "Sample Format", 0x153, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAny TIFF_TAG_SMIN_SAMPLE_VALUE = new TagInfoAny(
+            "SMin Sample Value", 0x154, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAny TIFF_TAG_SMAX_SAMPLE_VALUE = new TagInfoAny(
+            "SMax Sample Value", 0x155, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_TRANSFER_RANGE = new TagInfoShort(
+            "Transfer Range", 0x156, 6,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_JPEG_PROC = new TagInfoShort(
+            "JPEGProc", 0x200, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoLong TIFF_TAG_JPEG_INTERCHANGE_FORMAT = new TagInfoLong(
+            "JPEGInterchange Format", 0x201, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT, true);
 
-    SUBFILE_TYPE(new TagInfo(
-            "Subfile Type", 0xFF, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    IMAGE_WIDTH(new TagInfo(
-            "Image Width", 0x100, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    IMAGE_LENGTH(new TagInfo(
-            "Image Length", 0x101, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    BITS_PER_SAMPLE(new TagInfo(
-            "Bits Per Sample", 0x102, FIELD_TYPE_DESCRIPTION_SHORT, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    COMPRESSION(new TagInfo(
-            "Compression", 0x103, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    PHOTOMETRIC_INTERPRETATION(new TagInfo(
-            "Photometric Interpretation", 0x106, FIELD_TYPE_DESCRIPTION_SHORT,
-            1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    THRESHHOLDING(new TagInfo(
-            "Threshholding", 0x107, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    CELL_WIDTH(new TagInfo("Cell Width",
-            0x108, FIELD_TYPE_DESCRIPTION_SHORT, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    CELL_LENGTH(new TagInfo(
-            "Cell Length", 0x109, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    FILL_ORDER(new TagInfo("Fill Order",
-            0x10A, FIELD_TYPE_DESCRIPTION_SHORT, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    DOCUMENT_NAME(new TagInfo(
-            "Document Name", 0x10D, FIELD_TYPE_DESCRIPTION_ASCII, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    IMAGE_DESCRIPTION(new TagInfo(
-            "Image Description", 0x10E, FIELD_TYPE_DESCRIPTION_ASCII, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    MAKE(new TagInfo("Make", 0x10F,
-            FIELD_TYPE_DESCRIPTION_ASCII, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    MODEL(new TagInfo("Model", 0x110,
-            FIELD_TYPE_DESCRIPTION_ASCII, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    STRIP_OFFSETS(new TagInfo.Offset(
-            "Strip Offsets", 0x111, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    ORIENTATION(new TagInfo(
-            "Orientation", 0x112, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    SAMPLES_PER_PIXEL(new TagInfo(
-            "Samples Per Pixel", 0x115, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    ROWS_PER_STRIP(new TagInfo(
-            "Rows Per Strip", 0x116, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    STRIP_BYTE_COUNTS(new TagInfo(
-            "Strip Byte Counts", 0x117, FIELD_TYPE_DESCRIPTION_LONG_OR_SHORT,
-            -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    MIN_SAMPLE_VALUE(new TagInfo(
-            "Min Sample Value", 0x118, FIELD_TYPE_DESCRIPTION_SHORT, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    MAX_SAMPLE_VALUE(new TagInfo(
-            "Max Sample Value", 0x119, FIELD_TYPE_DESCRIPTION_SHORT, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    XRESOLUTION(new TagInfo(
-            "XResolution", 0x11A, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    YRESOLUTION(new TagInfo(
-            "YResolution", 0x11B, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    PLANAR_CONFIGURATION(new TagInfo(
-            "Planar Configuration", 0x11C, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    PAGE_NAME(new TagInfo("Page Name",
-            0x11D, FIELD_TYPE_DESCRIPTION_ASCII, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    XPOSITION(new TagInfo("XPosition",
-            0x11E, FIELD_TYPE_DESCRIPTION_RATIONAL, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    YPOSITION(new TagInfo("YPosition",
-            0x11F, FIELD_TYPE_DESCRIPTION_RATIONAL, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    FREE_OFFSETS(new TagInfo(
-            "Free Offsets", 0x120, FIELD_TYPE_DESCRIPTION_LONG, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    FREE_BYTE_COUNTS(new TagInfo(
-            "Free Byte Counts", 0x121, FIELD_TYPE_DESCRIPTION_LONG, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    GRAY_RESPONSE_UNIT(new TagInfo(
-            "Gray Response Unit", 0x122, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    GRAY_RESPONSE_CURVE(new TagInfo(
-            "Gray Response Curve", 0x123, FIELD_TYPE_DESCRIPTION_SHORT, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    T4_OPTIONS(new TagInfo("T4 Options",
-            0x124, FIELD_TYPE_DESCRIPTION_LONG, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    T6_OPTIONS(new TagInfo("T6 Options",
-            0x125, FIELD_TYPE_DESCRIPTION_LONG, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    RESOLUTION_UNIT(new TagInfo(
-            "Resolution Unit", 0x128, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    PAGE_NUMBER(new TagInfo(
-            "Page Number", 0x129, FIELD_TYPE_DESCRIPTION_SHORT, 2,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    TRANSFER_FUNCTION(new TagInfo(
-            "Transfer Function", 0x12D, FIELD_TYPE_DESCRIPTION_SHORT, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    SOFTWARE(new TagInfo("Software",
-            0x131, FIELD_TYPE_DESCRIPTION_ASCII, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    DATE_TIME(new TagInfo("Date Time",
-            0x132, FIELD_TYPE_DESCRIPTION_ASCII, 20, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    ARTIST(new TagInfo("Artist", 0x13B,
-            FIELD_TYPE_DESCRIPTION_ASCII, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    HOST_COMPUTER(new TagInfo(
-            "Host Computer", 0x13C, FIELD_TYPE_DESCRIPTION_ASCII, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    PREDICTOR(new TagInfo("Predictor",
-            0x13D, FIELD_TYPE_DESCRIPTION_SHORT, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    WHITE_POINT(new TagInfo(
-            "White Point", 0x13E, FIELD_TYPE_DESCRIPTION_RATIONAL, 2,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    PRIMARY_CHROMATICITIES(new TagInfo(
-            "Primary Chromaticities", 0x13F, FIELD_TYPE_DESCRIPTION_RATIONAL,
-            6, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    COLOR_MAP(new TagInfo("Color Map",
-            0x140, FIELD_TYPE_DESCRIPTION_SHORT, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    HALFTONE_HINTS(new TagInfo(
-            "Halftone Hints", 0x141, FIELD_TYPE_DESCRIPTION_SHORT, 2,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    TILE_WIDTH(new TagInfo("Tile Width",
-            0x142, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    TILE_LENGTH(new TagInfo(
-            "Tile Length", 0x143, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    TILE_OFFSETS(new TagInfo.Offset(
-            "Tile Offsets", 0x144, FIELD_TYPE_DESCRIPTION_LONG, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    TILE_BYTE_COUNTS(new TagInfo(
-            "Tile Byte Counts", 0x145, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG,
-            -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    INK_SET(new TagInfo("Ink Set",
-            0x14C, FIELD_TYPE_DESCRIPTION_SHORT, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    INK_NAMES(new TagInfo("Ink Names",
-            0x14D, FIELD_TYPE_DESCRIPTION_ASCII, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    NUMBER_OF_INKS(new TagInfo(
-            "Number Of Inks", 0x14E, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    DOT_RANGE(new TagInfo("Dot Range",
-            0x150, FIELD_TYPE_DESCRIPTION_BYTE_OR_SHORT, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    TARGET_PRINTER(new TagInfo(
-            "Target Printer", 0x151, FIELD_TYPE_DESCRIPTION_ASCII, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    EXTRA_SAMPLES(new TagInfo(
-            "Extra Samples", 0x152, FIELD_TYPE_DESCRIPTION_BYTE, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    SAMPLE_FORMAT(new TagInfo(
-            "Sample Format", 0x153, FIELD_TYPE_DESCRIPTION_SHORT, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    SMIN_SAMPLE_VALUE(new TagInfo(
-            "SMin Sample Value", 0x154, FIELD_TYPE_DESCRIPTION_ANY, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    SMAX_SAMPLE_VALUE(new TagInfo(
-            "SMax Sample Value", 0x155, FIELD_TYPE_DESCRIPTION_ANY, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    TRANSFER_RANGE(new TagInfo(
-            "Transfer Range", 0x156, FIELD_TYPE_DESCRIPTION_SHORT, 6,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    JPEG_PROC(new TagInfo("JPEGProc",
-            0x200, FIELD_TYPE_DESCRIPTION_SHORT, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    JPEG_INTERCHANGE_FORMAT(new TagInfo.Offset(
-            "JPEGInterchange Format", 0x201, FIELD_TYPE_DESCRIPTION_LONG, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    JPEG_INTERCHANGE_FORMAT_LENGTH(new TagInfo(
+    public static final TagInfoLong TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH = new TagInfoLong(
             "JPEGInterchange Format Length", 0x202,
-            FIELD_TYPE_DESCRIPTION_LONG, 1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    JPEG_RESTART_INTERVAL(new TagInfo(
-            "JPEGRestart Interval", 0x203, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    JPEG_LOSSLESS_PREDICTORS(new TagInfo(
-            "JPEGLossless Predictors", 0x205, FIELD_TYPE_DESCRIPTION_SHORT, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    JPEG_POINT_TRANSFORMS(new TagInfo(
-            "JPEGPoint Transforms", 0x206, FIELD_TYPE_DESCRIPTION_SHORT, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    JPEG_QTABLES(new TagInfo(
-            "JPEGQTables", 0x207, FIELD_TYPE_DESCRIPTION_LONG, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    JPEG_DCTABLES(new TagInfo(
-            "JPEGDCTables", 0x208, FIELD_TYPE_DESCRIPTION_LONG, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    JPEG_ACTABLES(new TagInfo(
-            "JPEGACTables", 0x209, FIELD_TYPE_DESCRIPTION_LONG, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    YCBCR_COEFFICIENTS(new TagInfo(
-            "YCbCr Coefficients", 0x211, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    YCBCR_SUB_SAMPLING(new TagInfo(
-            "YCbCr Sub Sampling", 0x212, FIELD_TYPE_DESCRIPTION_SHORT, 2,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    YCBCR_POSITIONING(new TagInfo(
-            "YCbCr Positioning", 0x213, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    REFERENCE_BLACK_WHITE(new TagInfo(
-            "Reference Black White", 0x214, FIELD_TYPE_DESCRIPTION_LONG, -1,
-            TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
-
-    COPYRIGHT(new TagInfo("Copyright",
-            0x8298, FIELD_TYPE_DESCRIPTION_ASCII, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
+            1, TiffDirectoryType.TIFF_DIRECTORY_ROOT);
 
-    XMP(new TagInfo("XMP",
-            0x2BC, FIELD_TYPE_DESCRIPTION_BYTE, -1, TiffDirectoryType.TIFF_DIRECTORY_ROOT)),
+    public static final TagInfoShort TIFF_TAG_JPEG_RESTART_INTERVAL = new TagInfoShort(
+            "JPEGRestart Interval", 0x203, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_JPEG_LOSSLESS_PREDICTORS = new TagInfoShort(
+            "JPEGLossless Predictors", 0x205, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_JPEG_POINT_TRANSFORMS = new TagInfoShort(
+            "JPEGPoint Transforms", 0x206, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoLong TIFF_TAG_JPEG_QTABLES = new TagInfoLong(
+            "JPEGQTables", 0x207, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoLong TIFF_TAG_JPEG_DCTABLES = new TagInfoLong(
+            "JPEGDCTables", 0x208, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoLong TIFF_TAG_JPEG_ACTABLES = new TagInfoLong(
+            "JPEGACTables", 0x209, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoRational TIFF_TAG_YCBCR_COEFFICIENTS = new TagInfoRational(
+            "YCbCr Coefficients", 0x211, 3,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_YCBCR_SUB_SAMPLING = new TagInfoShort(
+            "YCbCr Sub Sampling", 0x212, 2,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoShort TIFF_TAG_YCBCR_POSITIONING = new TagInfoShort(
+            "YCbCr Positioning", 0x213, 1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoLong TIFF_TAG_REFERENCE_BLACK_WHITE = new TagInfoLong(
+            "Reference Black White", 0x214, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoAscii TIFF_TAG_COPYRIGHT = new TagInfoAscii(
+            "Copyright", 0x8298, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
+
+    public static final TagInfoByte TIFF_TAG_XMP = new TagInfoByte(
+            "XMP", 0x2BC, -1,
+            TiffDirectoryType.TIFF_DIRECTORY_ROOT);
 
     // TODO:
-    //    public static final TagInfo2 UNKNOWN(null;
-    UNKNOWN(new TagInfo.Unknown(
-            "Unknown Tag", -1, FIELD_TYPE_DESCRIPTION_UNKNOWN,
-            TagInfo.LENGTH_UNKNOWN, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN));
-    
-    public final TagInfo tagInfo;
-    
-    TiffTagConstants(TagInfo tagInfo) {
-        this.tagInfo = tagInfo;
-    }
-    
-    public TagInfo getTagInfo() {
-        return tagInfo;
-    }
-    
-    public static final List<TagInfo> ALL_TIFF_TAGS = Collections.unmodifiableList(
-            TagConstantsUtils.mergeTagLists(values()));
+    //    public static final TagInfo2 TIFF_TAG_UNKNOWN = null;
+    public static final TagInfo TIFF_TAG_UNKNOWN = new TagInfoUnknown(
+            "Unknown Tag", -1, TagInfo.LENGTH_UNKNOWN,
+            TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+
+    public static final List<TagInfo> ALL_TIFF_TAGS =
+            Collections.unmodifiableList(Arrays.asList(
+                    TIFF_TAG_NEW_SUBFILE_TYPE, TIFF_TAG_SUBFILE_TYPE,
+                    TIFF_TAG_IMAGE_WIDTH, TIFF_TAG_IMAGE_LENGTH,
+                    TIFF_TAG_BITS_PER_SAMPLE, TIFF_TAG_COMPRESSION,
+                    TIFF_TAG_PHOTOMETRIC_INTERPRETATION, TIFF_TAG_THRESHHOLDING,
+                    TIFF_TAG_CELL_WIDTH, TIFF_TAG_CELL_LENGTH, TIFF_TAG_FILL_ORDER,
+                    TIFF_TAG_DOCUMENT_NAME, TIFF_TAG_IMAGE_DESCRIPTION, TIFF_TAG_MAKE,
+                    TIFF_TAG_MODEL, TIFF_TAG_STRIP_OFFSETS, TIFF_TAG_ORIENTATION,
+                    TIFF_TAG_SAMPLES_PER_PIXEL, TIFF_TAG_ROWS_PER_STRIP,
+                    TIFF_TAG_STRIP_BYTE_COUNTS, TIFF_TAG_MIN_SAMPLE_VALUE,
+                    TIFF_TAG_MAX_SAMPLE_VALUE, TIFF_TAG_XRESOLUTION,
+                    TIFF_TAG_YRESOLUTION, TIFF_TAG_PLANAR_CONFIGURATION,
+                    TIFF_TAG_PAGE_NAME, TIFF_TAG_XPOSITION, TIFF_TAG_YPOSITION,
+                    TIFF_TAG_FREE_OFFSETS, TIFF_TAG_FREE_BYTE_COUNTS,
+                    TIFF_TAG_GRAY_RESPONSE_UNIT, TIFF_TAG_GRAY_RESPONSE_CURVE,
+                    TIFF_TAG_T4_OPTIONS, TIFF_TAG_T6_OPTIONS, TIFF_TAG_RESOLUTION_UNIT,
+                    TIFF_TAG_PAGE_NUMBER, TIFF_TAG_TRANSFER_FUNCTION,
+                    TIFF_TAG_SOFTWARE, TIFF_TAG_DATE_TIME, TIFF_TAG_ARTIST,
+                    TIFF_TAG_HOST_COMPUTER, TIFF_TAG_PREDICTOR, TIFF_TAG_WHITE_POINT,
+                    TIFF_TAG_PRIMARY_CHROMATICITIES, TIFF_TAG_COLOR_MAP,
+                    TIFF_TAG_HALFTONE_HINTS, TIFF_TAG_TILE_WIDTH, TIFF_TAG_TILE_LENGTH,
+                    TIFF_TAG_TILE_OFFSETS, TIFF_TAG_TILE_BYTE_COUNTS, TIFF_TAG_INK_SET,
+                    TIFF_TAG_INK_NAMES, TIFF_TAG_NUMBER_OF_INKS, TIFF_TAG_DOT_RANGE,
+                    TIFF_TAG_TARGET_PRINTER, TIFF_TAG_EXTRA_SAMPLES,
+                    TIFF_TAG_SAMPLE_FORMAT, TIFF_TAG_SMIN_SAMPLE_VALUE,
+                    TIFF_TAG_SMAX_SAMPLE_VALUE, TIFF_TAG_TRANSFER_RANGE,
+                    TIFF_TAG_JPEG_PROC, TIFF_TAG_JPEG_INTERCHANGE_FORMAT,
+                    TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH,
+                    TIFF_TAG_JPEG_RESTART_INTERVAL, TIFF_TAG_JPEG_LOSSLESS_PREDICTORS,
+                    TIFF_TAG_JPEG_POINT_TRANSFORMS, TIFF_TAG_JPEG_QTABLES,
+                    TIFF_TAG_JPEG_DCTABLES, TIFF_TAG_JPEG_ACTABLES,
+                    TIFF_TAG_YCBCR_COEFFICIENTS, TIFF_TAG_YCBCR_SUB_SAMPLING,
+                    TIFF_TAG_YCBCR_POSITIONING, TIFF_TAG_REFERENCE_BLACK_WHITE,
+                    TIFF_TAG_COPYRIGHT,
+                    TIFF_TAG_XMP));
 }
\ No newline at end of file

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReader.java?rev=1245871&r1=1245870&r2=1245871&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReader.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReader.java Sat Feb 18 06:43:33 2012
@@ -111,7 +111,7 @@ public abstract class DataReader impleme
     protected byte[] decompress(byte compressed[], int compression,
             int expected_size, int tileWidth, int tileHeight) throws ImageReadException, IOException
     {
-        TiffField fillOrderField = directory.findField(TiffTagConstants.FILL_ORDER.tagInfo);
+        TiffField fillOrderField = directory.findField(TiffTagConstants.TIFF_TAG_FILL_ORDER);
         int fillOrder = ExifTagConstants.FILL_ORDER_VALUE_NORMAL;
         if (fillOrderField != null) {
             fillOrder = fillOrderField.getIntValue();
@@ -135,7 +135,7 @@ public abstract class DataReader impleme
             case TIFF_COMPRESSION_CCITT_GROUP_3 :
             {
                 int t4Options = 0;
-                TiffField field = directory.findField(TiffTagConstants.T4_OPTIONS.tagInfo);
+                TiffField field = directory.findField(TiffTagConstants.TIFF_TAG_T4_OPTIONS);
                 if (field != null) {
                     t4Options = field.getIntValue();
                 }
@@ -154,7 +154,7 @@ public abstract class DataReader impleme
             case TIFF_COMPRESSION_CCITT_GROUP_4 :
             {
                 int t6Options = 0;
-                TiffField field = directory.findField(TiffTagConstants.T6_OPTIONS.tagInfo);
+                TiffField field = directory.findField(TiffTagConstants.TIFF_TAG_T6_OPTIONS);
                 if (field != null) {
                     t6Options = field.getIntValue();
                 }

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/fieldtypes/FieldTypeAscii.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/fieldtypes/FieldTypeAscii.java?rev=1245871&r1=1245870&r2=1245871&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/fieldtypes/FieldTypeAscii.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/fieldtypes/FieldTypeAscii.java Sat Feb 18 06:43:33 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.sanselan.formats.tiff.fieldtypes;
 
+import java.io.UnsupportedEncodingException;
+
 import org.apache.commons.sanselan.ImageWriteException;
 import org.apache.commons.sanselan.formats.tiff.TiffField;
 
@@ -29,8 +31,42 @@ public class FieldTypeAscii extends Fiel
     public Object getSimpleValue(TiffField entry) {
         // According to EXIF specification "2 = ASCII An 8-bit byte containing one 7-bit ASCII code. The final byte is terminated with NULL."
         byte bytes[] = getRawBytes(entry);
-        // Ignore last (should be NULL) byte.
-        return new String(bytes, 0, bytes.length-1);
+        int nullCount = 1;
+        for (int i = 0; i < bytes.length - 1; i++) {
+            if (bytes[i] == 0) {
+                nullCount++;
+            }
+        }
+        String[] strings = new String[nullCount];
+        int stringsAdded = 0;
+        strings[0] = ""; // if we have a 0 length string
+        int nextStringPos = 0;
+        // According to the Exiftool FAQ, http://www.metadataworkinggroup.org
+        // specifies that the TIFF ASCII fields are actually UTF-8.
+        // Exiftool however allows you to configure the charset used.
+        for (int i = 0; i < bytes.length; i++) {
+            if (bytes[i] == 0) {
+                try {
+                    String string = new String(bytes, nextStringPos, i - nextStringPos, "UTF-8");
+                    strings[stringsAdded++] = string;
+                } catch (UnsupportedEncodingException unsupportedEncoding) {
+                }
+                nextStringPos = i + 1;
+            }
+        }
+        if (nextStringPos < bytes.length) {
+            // Buggy file, string wasn't null terminated
+            try {
+                String string = new String(bytes, nextStringPos, bytes.length - nextStringPos, "UTF-8");
+                strings[stringsAdded++] = string;
+            } catch (UnsupportedEncodingException unsupportedEncoding) {
+            }
+        }
+        if (strings.length == 1) {
+            return strings[0];
+        } else {
+            return strings;
+        }
     }
 
     public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
@@ -42,11 +78,33 @@ public class FieldTypeAscii extends Fiel
             result[result.length - 1] = 0;
             return result;
         } else if (o instanceof String) {
-            byte bytes[] = ((String) o).getBytes();
+            byte[] bytes = null;
+            try {
+                bytes = ((String) o).getBytes("UTF-8");
+            } catch (UnsupportedEncodingException cannotHappen) {
+            }
             byte result[] = new byte[bytes.length + 1];
             System.arraycopy(bytes, 0, result, 0, bytes.length);
             result[result.length - 1] = 0;
             return result;
+        } else if (o instanceof String[]) {
+            String[] strings = (String[])o;
+            int totalLength = 0;
+            for (int i = 0; i < strings.length; i++) {
+                totalLength += (strings[i].getBytes().length + 1);
+            }
+            byte[] result = new byte[totalLength];
+            int position = 0;
+            for (int i = 0; i < strings.length; i++) {
+                byte[] bytes = null;
+                try {
+                    bytes = strings[i].getBytes("UTF-8");
+                } catch (UnsupportedEncodingException cannotHappen) {
+                }
+                System.arraycopy(bytes, 0, result, position, bytes.length);
+                position += (bytes.length + 1);
+            }
+            return result;
         }
         else
             throw new ImageWriteException("Unknown data type: " + o);

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/fieldtypes/FieldTypeShort.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/fieldtypes/FieldTypeShort.java?rev=1245871&r1=1245870&r2=1245871&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/fieldtypes/FieldTypeShort.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/fieldtypes/FieldTypeShort.java Sat Feb 18 06:43:33 2012
@@ -18,6 +18,7 @@ package org.apache.commons.sanselan.form
 
 import org.apache.commons.sanselan.ImageReadException;
 import org.apache.commons.sanselan.ImageWriteException;
+import org.apache.commons.sanselan.common.BinaryConversions;
 import org.apache.commons.sanselan.formats.tiff.TiffField;
 import org.apache.commons.sanselan.util.Debug;
 
@@ -45,32 +46,29 @@ public class FieldTypeShort extends Fiel
     public Object getSimpleValue(TiffField entry) throws ImageReadException
     {
         if (entry.length == 1)
-            return new Integer(convertByteArrayToShort(name + " ("
-                    + entry.tagInfo.name + ")", entry.valueOffsetBytes,
-                    entry.byteOrder));
+            return BinaryConversions.convertToShort(entry.valueOffsetBytes, entry.byteOrder);
 
-        return convertByteArrayToShortArray(name + " (" + entry.tagInfo.name
-                + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
+        return BinaryConversions.convertToShortArray(getRawBytes(entry), entry.byteOrder);
     }
 
     public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
     {
-        if (o instanceof Integer)
-            return convertShortArrayToByteArray(new int[]{
-                ((Integer) o).intValue(),
+        if (o instanceof Short)
+            return BinaryConversions.convertToByteArray(new short[]{
+                ((Short)o).shortValue(),
             }, byteOrder);
-        else if (o instanceof int[])
+        else if (o instanceof short[])
         {
-            int numbers[] = (int[]) o;
-            return convertShortArrayToByteArray(numbers, byteOrder);
+            short numbers[] = (short[]) o;
+            return BinaryConversions.convertToByteArray(numbers, byteOrder);
         }
-        else if (o instanceof Integer[])
+        else if (o instanceof Short[])
         {
-            Integer numbers[] = (Integer[]) o;
-            int values[] = new int[numbers.length];
+            Short numbers[] = (Short[]) o;
+            short values[] = new short[numbers.length];
             for (int i = 0; i < values.length; i++)
-                values[i] = numbers[i].intValue();
-            return convertShortArrayToByteArray(values, byteOrder);
+                values[i] = numbers[i].shortValue();
+            return BinaryConversions.convertToByteArray(values, byteOrder);
         }
         else
             throw new ImageWriteException("Invalid data: " + o + " ("

Added: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/taginfos/TagInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/taginfos/TagInfo.java?rev=1245871&view=auto
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/taginfos/TagInfo.java (added)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/taginfos/TagInfo.java Sat Feb 18 06:43:33 2012
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.sanselan.formats.tiff.taginfos;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.sanselan.ImageReadException;
+import org.apache.commons.sanselan.ImageWriteException;
+import org.apache.commons.sanselan.formats.tiff.TiffField;
+import org.apache.commons.sanselan.formats.tiff.constants.TiffDirectoryConstants;
+import org.apache.commons.sanselan.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.sanselan.formats.tiff.constants.TiffFieldTypeConstants;
+import org.apache.commons.sanselan.formats.tiff.fieldtypes.FieldType;
+
+public abstract class TagInfo implements TiffDirectoryConstants, TiffFieldTypeConstants
+{
+    public static final int LENGTH_UNKNOWN = -1;
+
+    public TagInfo(String name, int tag, FieldType dataType, int length,
+            TiffDirectoryType exifDirectory)
+    {
+        this(name, tag, Arrays.asList(dataType), length, exifDirectory);
+    }
+
+    public TagInfo(String name, int tag, FieldType dataType, int length,
+            TiffDirectoryType exifDirectory, boolean isOffset)
+    {
+        this(name, tag, Arrays.asList(dataType), length, exifDirectory, isOffset);
+    }
+
+    public TagInfo(String name, int tag, FieldType dataType, int length)
+    {
+        this(name, tag, Arrays.asList(dataType), length, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+    }
+
+    public TagInfo(String name, int tag, FieldType dataType)
+    {
+        this(name, tag, dataType, LENGTH_UNKNOWN, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
+    }
+
+    public final String name;
+    public final int tag;
+    public final List<FieldType> dataTypes;
+    public final int length;
+    public final TiffDirectoryType directoryType;
+    private final boolean isOffset;
+
+    public TagInfo(String name, int tag, List<FieldType> dataTypes, int length,
+            TiffDirectoryType exifDirectory)
+    {
+        this(name, tag, dataTypes, length, exifDirectory, false);
+    }
+
+    public TagInfo(String name, int tag, List<FieldType> dataTypes, int length,
+            TiffDirectoryType exifDirectory, boolean isOffset)
+    {
+        this.name = name;
+        this.tag = tag;
+        this.dataTypes = Collections.unmodifiableList(new ArrayList<FieldType>(dataTypes));
+        this.length = length;
+        this.directoryType = exifDirectory;
+        this.isOffset = isOffset;
+    }
+    
+    public Object getValue(TiffField entry) throws ImageReadException
+    {
+        Object o = entry.fieldType.getSimpleValue(entry);
+        return o;
+    }
+
+    public byte[] encodeValue(FieldType fieldType, Object value, int byteOrder)
+            throws ImageWriteException
+    {
+        return fieldType.writeData(value, byteOrder);
+    }
+
+    public String getDescription()
+    {
+        return tag + " (0x" + Integer.toHexString(tag) + ": " + name + "): ";
+    }
+
+    public String toString()
+    {
+        return "[TagInfo. tag: " + tag + " (0x" + Integer.toHexString(tag)
+                + ", name: " + name + "]";
+    }
+
+    public boolean isOffset()
+    {
+        return isOffset;
+    }
+
+    public boolean isText()
+    {
+        return false;
+    }
+}
\ No newline at end of file

Propchange: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/taginfos/TagInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message