commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1445822 [2/3] - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/common/ main/java/org/apache/commons/imaging/common/bytesource/ main/java/org/apache/commons/imaging/common/mylzw/ main/java/org/apache/commons/imag...
Date Wed, 13 Feb 2013 18:40:53 GMT
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/AdobePageMaker6TagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/AdobePageMaker6TagConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/AdobePageMaker6TagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/AdobePageMaker6TagConstants.java Wed Feb 13 18:40:52 2013
@@ -23,6 +23,7 @@ import java.util.List;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoAscii;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoByte;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoLongOrIFD;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoLong;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShort;
 
@@ -33,8 +34,8 @@ import org.apache.commons.imaging.format
  * <BR>
  * http://partners.adobe.com/public/developer/en/tiff/TIFFPM6.pdf
  */
-public interface AdobePageMaker6TagConstants extends TiffFieldTypeConstants {
-    public static final TagInfoLong TIFF_TAG_SUB_IFD = new TagInfoLong(
+public interface AdobePageMaker6TagConstants {
+    public static final TagInfoLongOrIFD TIFF_TAG_SUB_IFD = new TagInfoLongOrIFD(
             "SubIFDs",  0x014a, -1,
             TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN, true);
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/AliasSketchbookProTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/AliasSketchbookProTagConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/AliasSketchbookProTagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/AliasSketchbookProTagConstants.java Wed Feb 13 18:40:52 2013
@@ -28,7 +28,7 @@ import org.apache.commons.imaging.format
  * <BR>
  * http://www.awaresystems.be/imaging/tiff/tifftags/docs/alias.html
  */
-public interface AliasSketchbookProTagConstants extends TiffFieldTypeConstants {
+public interface AliasSketchbookProTagConstants {
     public static final TagInfoAscii EXIF_TAG_ALIAS_LAYER_METADATA = new TagInfoAscii(
             "Alias Layer Metadata", 0xc660, -1,
             TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/DcfTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/DcfTagConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/DcfTagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/DcfTagConstants.java Wed Feb 13 18:40:52 2013
@@ -30,7 +30,7 @@ import org.apache.commons.imaging.format
  * <BR>
  * http://www.exif.org/dcf.PDF
  */
-public interface DcfTagConstants extends TiffFieldTypeConstants {
+public interface DcfTagConstants {
     public static final TagInfoAscii EXIF_TAG_RELATED_IMAGE_FILE_FORMAT = new TagInfoAscii(
             "RelatedImageFileFormat", 0x1000, -1,
             TiffDirectoryType.EXIF_DIRECTORY_INTEROP_IFD);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/DngTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/DngTagConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/DngTagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/DngTagConstants.java Wed Feb 13 18:40:52 2013
@@ -40,7 +40,7 @@ import org.apache.commons.imaging.format
  * <BR>
  * http://www.adobe.com/products/dng/pdfs/dng_spec_1_3_0_0.pdf
  */
-public interface DngTagConstants extends TiffFieldTypeConstants {
+public interface DngTagConstants {
     public static final TagInfoByte EXIF_TAG_DNG_VERSION = new TagInfoByte(
             "DNGVersion", 0xc612, 4,
             TiffDirectoryType.EXIF_DIRECTORY_IFD0);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/ExifTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/ExifTagConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/ExifTagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/ExifTagConstants.java Wed Feb 13 18:40:52 2013
@@ -26,6 +26,7 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoDouble;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoGpsText;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoLong;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoDirectory;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoRational;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoSLong;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoSRational;
@@ -42,10 +43,7 @@ import org.apache.commons.imaging.format
  * 
  * "Stonits": http://www.anyhere.com/gward/pixformat/tiffluv.html
  */
-public interface ExifTagConstants
-        extends
-            TiffFieldTypeConstants
-{
+public interface ExifTagConstants {
     public static final TagInfoAscii EXIF_TAG_INTEROPERABILITY_INDEX = new TagInfoAscii(
             "InteroperabilityIndex", 0x0001, -1,
             TiffDirectoryType.EXIF_DIRECTORY_INTEROP_IFD);
@@ -191,9 +189,9 @@ public interface ExifTagConstants
     public static final TagInfoByte EXIF_TAG_PHOTOSHOP_SETTINGS = new TagInfoByte(
             "PhotoshopSettings", 0x8649, -1,
             TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
-    public static final TagInfoLong EXIF_TAG_EXIF_OFFSET = new TagInfoLong(
+    public static final TagInfoDirectory EXIF_TAG_EXIF_OFFSET = new TagInfoDirectory(
             "ExifOffset", 0x8769, 1,
-            TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN, true);
+            TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
     public static final TagInfoShort EXIF_TAG_EXPOSURE_PROGRAM = new TagInfoShort(
             "ExposureProgram", 0x8822, 1,
             TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD);
@@ -208,9 +206,9 @@ public interface ExifTagConstants
     public static final TagInfoAscii EXIF_TAG_SPECTRAL_SENSITIVITY = new TagInfoAscii(
             "SpectralSensitivity", 0x8824, -1,
             TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD);
-    public static final TagInfoLong EXIF_TAG_GPSINFO = new TagInfoLong(
+    public static final TagInfoDirectory EXIF_TAG_GPSINFO = new TagInfoDirectory(
             "GPSInfo", 0x8825, 1,
-            TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN, true);
+            TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
     public static final TagInfoShort EXIF_TAG_ISO = new TagInfoShort(
             "PhotographicSensitivity", 0x8827, -1,
             TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD);
@@ -328,7 +326,7 @@ public interface ExifTagConstants
             "MakerNote", 0x927c, 1,
             TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD);
     public static final TagInfoGpsText EXIF_TAG_USER_COMMENT = new TagInfoGpsText(
-            "UserComment", 0x9286, FIELD_TYPE_UNDEFINED, 1,
+            "UserComment", 0x9286, 1,
             TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD);
     public static final TagInfoAscii EXIF_TAG_SUB_SEC_TIME = new TagInfoAscii(
             "SubSecTime", 0x9290, -1,
@@ -351,9 +349,9 @@ public interface ExifTagConstants
     public static final TagInfoAscii EXIF_TAG_RELATED_SOUND_FILE = new TagInfoAscii(
             "RelatedSoundFile", 0xa004, 13,
             TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD);
-    public static final TagInfoLong EXIF_TAG_INTEROP_OFFSET = new TagInfoLong(
+    public static final TagInfoDirectory EXIF_TAG_INTEROP_OFFSET = new TagInfoDirectory(
             "InteropOffset", 0xa005, 1,
-            TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN, true);
+            TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
     public static final TagInfoRational EXIF_TAG_FLASH_ENERGY_EXIF_IFD = new TagInfoRational(
             "FlashEnergy", 0xa20b, -1,
             TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/GpsTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/GpsTagConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/GpsTagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/GpsTagConstants.java Wed Feb 13 18:40:52 2013
@@ -23,12 +23,11 @@ import java.util.List;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoAscii;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoByte;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoGpsText;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoRational;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShort;
-import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoGpsText;
 
-public interface GpsTagConstants
-        extends TiffFieldTypeConstants {
+public interface GpsTagConstants {
     public static final TagInfoByte GPS_TAG_GPS_VERSION_ID = new TagInfoByte(
             "GPSVersionID", 0x0000, 4,
             TiffDirectoryType.EXIF_DIRECTORY_GPS);
@@ -191,12 +190,12 @@ public interface GpsTagConstants
 
     // ************************************************************
     public static final TagInfoGpsText GPS_TAG_GPS_PROCESSING_METHOD = new TagInfoGpsText(
-            "GPSProcessingMethod", 0x001b, FIELD_TYPE_UNKNOWN,
-            -1, TiffDirectoryType.EXIF_DIRECTORY_GPS);
+            "GPSProcessingMethod", 0x001b, -1,
+            TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************
     public static final TagInfoGpsText GPS_TAG_GPS_AREA_INFORMATION = new TagInfoGpsText(
-            "GPSAreaInformation", 0x001c, FIELD_TYPE_UNKNOWN, -1,
+            "GPSAreaInformation", 0x001c, -1,
             TiffDirectoryType.EXIF_DIRECTORY_GPS);
 
     // ************************************************************

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/HylaFaxTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/HylaFaxTagConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/HylaFaxTagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/HylaFaxTagConstants.java Wed Feb 13 18:40:52 2013
@@ -24,7 +24,7 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoAscii;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoLong;
 
-public interface HylaFaxTagConstants extends TiffFieldTypeConstants {
+public interface HylaFaxTagConstants {
     public static final TagInfoLong EXIF_TAG_FAX_RECV_PARAMS = new TagInfoLong(
             "FaxRecvParams", 0x885c, 1,
             TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/MicrosoftHdPhotoTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/MicrosoftHdPhotoTagConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/MicrosoftHdPhotoTagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/MicrosoftHdPhotoTagConstants.java Wed Feb 13 18:40:52 2013
@@ -30,7 +30,7 @@ import org.apache.commons.imaging.format
 /**
  * Microsoft's HDP/WDP file format. 
  */
-public interface MicrosoftHdPhotoTagConstants extends TiffFieldTypeConstants {
+public interface MicrosoftHdPhotoTagConstants {
     /*
      * The byte order for this GUID field is as follows:
      * Data1 (int), Data2 (short), Data3 (short) are little-endian,

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/MolecularDynamicsGelTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/MolecularDynamicsGelTagConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/MolecularDynamicsGelTagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/MolecularDynamicsGelTagConstants.java Wed Feb 13 18:40:52 2013
@@ -31,7 +31,7 @@ import org.apache.commons.imaging.format
  * <BR>  
  * http://www.awaresystems.be/imaging/tiff/tifftags/docs/gel.html
  */
-public interface MolecularDynamicsGelTagConstants extends TiffFieldTypeConstants {
+public interface MolecularDynamicsGelTagConstants {
     public static final TagInfoLong EXIF_TAG_MD_FILE_TAG = new TagInfoLong(
             "MD FileTag", 0x82a5, 1,
             TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/Rfc2301TagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/Rfc2301TagConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/Rfc2301TagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/Rfc2301TagConstants.java Wed Feb 13 18:40:52 2013
@@ -23,6 +23,7 @@ import java.util.List;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoByte;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoLong;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoDirectory;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoRational;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShort;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShortOrLong;
@@ -36,7 +37,7 @@ import org.apache.commons.imaging.format
  * <BR>
  * http://cool.conservation-us.org/bytopic/imaging/std/tiff-f.html
  */
-public interface Rfc2301TagConstants extends TiffFieldTypeConstants {
+public interface Rfc2301TagConstants {
     public static final TagInfoShortOrLong TIFF_TAG_BAD_FAX_LINES = new TagInfoShortOrLong(
             "BadFaxLines", 0x0146, 1,
             TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
@@ -52,9 +53,9 @@ public interface Rfc2301TagConstants ext
             "ConsecutiveBadFaxLines", 0x0148, 1,
             TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
 
-    public static final TagInfoLong TIFF_TAG_GLOBAL_PARAMETERS_IFD = new TagInfoLong(
+    public static final TagInfoDirectory TIFF_TAG_GLOBAL_PARAMETERS_IFD = new TagInfoDirectory(
             "GlobalParametersIFD", 0x0190, 1,
-            TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN, true);
+            TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
     
     public static final TagInfoLong TIFF_TAG_PROFILE_TYPE = new TagInfoLong(
             "ProfileType", 0x0191, 1,

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java Wed Feb 13 18:40:52 2013
@@ -22,7 +22,6 @@ import org.apache.commons.imaging.common
 public interface TiffConstants
         extends
             ImagingConstants,
-            TiffFieldTypeConstants,
             TiffDirectoryConstants,
             AllTagConstants {
     public static final ByteOrder DEFAULT_TIFF_BYTE_ORDER = ByteOrder.INTEL;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffEpTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffEpTagConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffEpTagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffEpTagConstants.java Wed Feb 13 18:40:52 2013
@@ -33,7 +33,7 @@ import org.apache.commons.imaging.format
 /**
  * 
  */
-public interface TiffEpTagConstants extends TiffFieldTypeConstants {
+public interface TiffEpTagConstants {
     public static final TagInfoShort EXIF_TAG_CFAREPEAT_PATTERN_DIM = new TagInfoShort(
             "CFARepeatPatternDim", 0x828d, 2,
             TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffTagConstants.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffTagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffTagConstants.java Wed Feb 13 18:40:52 2013
@@ -36,8 +36,7 @@ import org.apache.commons.imaging.format
  * <BR>
  * http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf
  */
-public interface TiffTagConstants
-        extends TiffFieldTypeConstants {
+public interface TiffTagConstants {
     public static final TagInfoLong TIFF_TAG_NEW_SUBFILE_TYPE = new TagInfoLong(
             "NewSubfileType", 0xFE, 1,
             TiffDirectoryType.TIFF_DIRECTORY_ROOT);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java Wed Feb 13 18:40:52 2013
@@ -1,112 +1,104 @@
-/*
- * 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.imaging.formats.tiff.fieldtypes;
 
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
-import org.apache.commons.imaging.common.BinaryFunctions;
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.TiffField;
-import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
 
-public abstract class FieldType extends BinaryFunctions implements
-        TiffConstants {
-    public final int type, length;
-    public final String name;
+/**
+ * TIFF field types.
+ */
+public abstract class FieldType {
+    public static final FieldTypeByte BYTE = new FieldTypeByte(1, "Byte");
+    public static final FieldTypeAscii ASCII = new FieldTypeAscii(2, "ASCII");
+    public static final FieldTypeShort SHORT = new FieldTypeShort(3, "Short");
+    public static final FieldTypeLong LONG = new FieldTypeLong(4, "Long");
+    public static final FieldTypeRational RATIONAL = new FieldTypeRational(5, "Rational");
+    public static final FieldTypeByte SBYTE = new FieldTypeByte(6, "SByte");
+    public static final FieldTypeByte UNDEFINED = new FieldTypeByte(7, "Undefined");
+    public static final FieldTypeShort SSHORT = new FieldTypeShort(8, "SShort");
+    public static final FieldTypeLong SLONG = new FieldTypeLong(9, "SLong");
+    public static final FieldTypeRational SRATIONAL = new FieldTypeRational(10, "SRational");
+    public static final FieldTypeFloat FLOAT = new FieldTypeFloat(11, "Float");
+    public static final FieldTypeDouble DOUBLE = new FieldTypeDouble(12, "Double");
+    public static final FieldTypeLong IFD = new FieldTypeLong(13, "IFD");
+
+    private final int type;
+    private final String name;
+    private final int elementSize;
 
-    public FieldType(final int type, final int length, final String name) {
+    protected FieldType(final int type, final String name, final int elementSize) {
         this.type = type;
-        this.length = length;
         this.name = name;
+        this.elementSize = elementSize;
     }
-
-    public boolean isLocalValue(final TiffField entry) {
-        // FIXME: we should use unsigned ints for offsets and lengths
-        // when parsing TIFF files. But since we don't,
-        // at least make this method treat length as unsigned,
-        // so that corrupt lengths are caught early.
-        final long entryLength = 0xffffffffL & entry.length;
-        return ((length > 0) && ((length * entryLength) <= TIFF_ENTRY_MAX_VALUE_LENGTH));
-    }
-
-    public int getBytesLength(final TiffField entry) throws ImageReadException {
-        if (length < 1) {
-            throw new ImageReadException("Unknown field type");
-        }
-
-        return length * entry.length;
-    }
-
-    // public static final byte[] STUB_LOCAL_VALUE = new
-    // byte[TIFF_ENTRY_MAX_VALUE_LENGTH];
-
-    public static final byte[] getStubLocalValue() {
-        return new byte[TIFF_ENTRY_MAX_VALUE_LENGTH];
-    }
-
-    public final byte[] getStubValue(final int count) {
-        return new byte[count * length];
-    }
-
-    public String getDisplayValue(final TiffField entry) throws ImageReadException {
-        final Object o = getSimpleValue(entry);
-        if (o == null) {
-            return "NULL";
-        }
-        return o.toString();
-    }
-
-    public final byte[] getRawBytes(final TiffField entry) {
-        if (isLocalValue(entry)) {
-            final int rawLength = length * entry.length;
-            final byte result[] = new byte[rawLength];
-            System.arraycopy(entry.valueOffsetBytes, 0, result, 0, rawLength);
-            return result;
-            // return readBytearray(name, entry.valueOffsetBytes, 0, length
-            // * entry.length);
-            // return getBytearrayHead(name + " (" + entry.tagInfo.name + ")",
-            // entry.valueOffsetBytes, length * entry.length);
+    
+    
+    public int getType() {
+        return type;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    
+    public int getSize() {
+        return elementSize;
+    }
+    
+    public static FieldType getFieldType(int type) throws ImageReadException {
+        for (final FieldType fieldType : ANY) {
+            if (fieldType.getType() == type) {
+                return fieldType;
+            }
         }
-
-        return entry.oversizeValue;
-    }
-
-    public abstract Object getSimpleValue(TiffField entry)
-            throws ImageReadException;
-
-    // public final Object getSimpleValue(TiffField entry)
-    // {
-    // Object array[] = getValueArray(entry);
-    // if (null == array)
-    // return null;
-    // if (array.length == 1)
-    // return array[0];
-    // return array;
-    // }
-    //
-    // public abstract Object[] getValueArray(TiffField entry);
-
-    @Override
-    public String toString() {
-        return "[" + getClass().getName() + ". type: " + type + ", name: "
-                + name + ", length: " + length + "]";
+        throw new ImageReadException("Field type " + type + " is unsupported");
     }
-
-    public abstract byte[] writeData(Object o, ByteOrder byteOrder)
-            throws ImageWriteException;
-
+    
+    public abstract Object getValue(final TiffField entry);
+    public abstract byte[] writeData(final Object o, final ByteOrder byteOrder) throws ImageWriteException;
+    
+    public static final List<FieldType> ANY =
+            Collections.unmodifiableList(Arrays.asList(
+                    BYTE, ASCII, SHORT,
+                    LONG, RATIONAL, SBYTE,
+                    UNDEFINED, SSHORT, SLONG,
+                    SRATIONAL, FLOAT, DOUBLE,
+                    IFD));
+
+    public static final List<FieldType> SHORT_OR_LONG =
+            Collections.unmodifiableList(Arrays.asList(
+                    SHORT, LONG));
+    
+    public static final List<FieldType> SHORT_OR_RATIONAL =
+            Collections.unmodifiableList(Arrays.asList(
+                    SHORT, RATIONAL));
+    
+    public static final List<FieldType> SHORT_OR_LONG_OR_RATIONAL =
+            Collections.unmodifiableList(Arrays.asList(
+                    SHORT, LONG, RATIONAL));
+    
+    public static final List<FieldType> LONG_OR_SHORT =
+            Collections.unmodifiableList(Arrays.asList(
+                    SHORT, LONG));
+    
+    public static final List<FieldType> BYTE_OR_SHORT =
+            Collections.unmodifiableList(Arrays.asList(
+                    SHORT, BYTE));
+    
+    public static final List<FieldType> LONG_OR_IFD =
+            Collections.unmodifiableList(Arrays.asList(
+                    (FieldType)LONG, IFD));
+    
+    public static final List<FieldType> ASCII_OR_RATIONAL =
+            Collections.unmodifiableList(Arrays.asList(
+                    ASCII, RATIONAL));
+    
+    public static final List<FieldType> ASCII_OR_BYTE =
+            Collections.unmodifiableList(Arrays.asList(
+                    ASCII, BYTE));
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeAscii.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeAscii.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeAscii.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeAscii.java Wed Feb 13 18:40:52 2013
@@ -24,14 +24,14 @@ import org.apache.commons.imaging.format
 
 public class FieldTypeAscii extends FieldType {
     public FieldTypeAscii(final int type, final String name) {
-        super(type, 1, name);
+        super(type, name, 1);
     }
 
     @Override
-    public Object getSimpleValue(final TiffField entry) {
+    public Object getValue(final 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."
-        final byte bytes[] = getRawBytes(entry);
+        final byte bytes[] = entry.getByteArrayValue();
         int nullCount = 1;
         for (int i = 0; i < bytes.length - 1; i++) {
             if (bytes[i] == 0) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByte.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByte.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByte.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByte.java Wed Feb 13 18:40:52 2013
@@ -23,16 +23,16 @@ import org.apache.commons.imaging.util.D
 
 public class FieldTypeByte extends FieldType {
     public FieldTypeByte(final int type, final String name) {
-        super(type, 1, name);
+        super(type, name, 1);
     }
 
     @Override
-    public Object getSimpleValue(final TiffField entry) {
-        if (entry.length == 1) {
-            return entry.valueOffsetBytes[0];
+    public Object getValue(final TiffField entry) {
+        final byte[] bytes = entry.getByteArrayValue();
+        if (entry.getCount() == 1) {
+            return bytes[0];
         }
-
-        return getRawBytes(entry);
+        return bytes;
     }
 
     @Override

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeDouble.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeDouble.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeDouble.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeDouble.java Wed Feb 13 18:40:52 2013
@@ -23,13 +23,18 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.util.Debug;
 
 public class FieldTypeDouble extends FieldType {
-    public FieldTypeDouble() {
-        super(12, 8, "Double");
+    public FieldTypeDouble(final int type, final String name) {
+        super(type, name, 8);
     }
 
     @Override
-    public Object getSimpleValue(final TiffField entry) {
-        return "?";
+    public Object getValue(final TiffField entry) {
+        final byte[] bytes = entry.getByteArrayValue();
+        if (entry.getCount() == 1) {
+            return ByteConversions.toDouble(bytes,
+                    entry.getByteOrder());
+        }
+        return ByteConversions.toDoubles(bytes, entry.getByteOrder());
     }
 
     @Override

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeFloat.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeFloat.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeFloat.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeFloat.java Wed Feb 13 18:40:52 2013
@@ -23,22 +23,18 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.util.Debug;
 
 public class FieldTypeFloat extends FieldType {
-    public FieldTypeFloat() {
-        super(11, 4, "Float");
+    public FieldTypeFloat(final int type, final String name) {
+        super(type, name, 4);
     }
 
-    // = new FieldType(11, 4, "Float")
-
     @Override
-    public Object getSimpleValue(final TiffField entry) {
-        if (entry.length == 1) {
-            return new Float(ByteConversions.toFloat(
-                    entry.valueOffsetBytes,
-                    entry.byteOrder));
+    public Object getValue(final TiffField entry) {
+        final byte[] bytes = entry.getByteArrayValue();
+        if (entry.getCount() == 1) {
+            return ByteConversions.toFloat(bytes,
+                    entry.getByteOrder());
         }
-
-        return ByteConversions.toFloats(getRawBytes(entry), 0, 4*entry.length,
-                entry.byteOrder);
+        return ByteConversions.toFloats(bytes, entry.getByteOrder());
     }
 
     @Override

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeLong.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeLong.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeLong.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeLong.java Wed Feb 13 18:40:52 2013
@@ -24,18 +24,17 @@ import org.apache.commons.imaging.util.D
 
 public class FieldTypeLong extends FieldType {
     public FieldTypeLong(final int type, final String name) {
-        super(type, 4, name);
+        super(type, name, 4);
     }
 
     @Override
-    public Object getSimpleValue(final TiffField entry) {
-        if (entry.length == 1) {
-            return ByteConversions.toInt(
-                    entry.valueOffsetBytes, entry.byteOrder);
+    public Object getValue(final TiffField entry) {
+        final byte[] bytes = entry.getByteArrayValue();
+        if (entry.getCount() == 1) {
+            return ByteConversions.toInt(bytes,
+                    entry.getByteOrder());
         }
-
-        return ByteConversions.toInts(getRawBytes(entry), 0, 4*entry.length,
-                entry.byteOrder);
+        return ByteConversions.toInts(bytes, entry.getByteOrder());
     }
 
     @Override

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeRational.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeRational.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeRational.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeRational.java Wed Feb 13 18:40:52 2013
@@ -26,17 +26,17 @@ import org.apache.commons.imaging.util.D
 
 public class FieldTypeRational extends FieldType {
     public FieldTypeRational(final int type, final String name) {
-        super(type, 8, name);
+        super(type, name, 8);
     }
 
     @Override
-    public Object getSimpleValue(final TiffField entry) {
-        if (entry.length == 1) {
-            return ByteConversions.toRational(entry.oversizeValue, entry.byteOrder);
+    public Object getValue(final TiffField entry) {
+        final byte[] bytes = entry.getByteArrayValue();
+        if (entry.getCount() == 1) {
+            return ByteConversions.toRational(bytes,
+                    entry.getByteOrder());
         }
-
-        return ByteConversions.toRationals(getRawBytes(entry), 0, 8*entry.length,
-                entry.byteOrder);
+        return ByteConversions.toRationals(bytes, entry.getByteOrder());
     }
 
     @Override

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeShort.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeShort.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeShort.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeShort.java Wed Feb 13 18:40:52 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.imaging.formats.tiff.fieldtypes;
 
-import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.common.ByteConversions;
 import org.apache.commons.imaging.common.ByteOrder;
@@ -25,18 +24,18 @@ import org.apache.commons.imaging.util.D
 
 public class FieldTypeShort extends FieldType {
     public FieldTypeShort(final int type, final String name) {
-        super(type, 2, name);
+        super(type, name, 2);
     }
 
     @Override
-    public Object getSimpleValue(final TiffField entry) throws ImageReadException {
-        if (entry.length == 1) {
-            return ByteConversions.toShort(entry.valueOffsetBytes,
-                    entry.byteOrder);
+    public Object getValue(final TiffField entry) {
+        final byte[] bytes = entry.getByteArrayValue();
+        if (entry.getCount() == 1) {
+            return ByteConversions.toShort(bytes,
+                    entry.getByteOrder());
         }
-
-        return ByteConversions.toShorts(getRawBytes(entry),
-                entry.byteOrder);
+        return ByteConversions.toShorts(bytes,
+                entry.getByteOrder());
     }
 
     @Override

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfo.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfo.java Wed Feb 13 18:40:52 2013
@@ -26,13 +26,10 @@ import org.apache.commons.imaging.ImageR
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.TiffField;
-import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryConstants;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
-import org.apache.commons.imaging.formats.tiff.constants.TiffFieldTypeConstants;
 import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
-public abstract class TagInfo implements TiffDirectoryConstants,
-        TiffFieldTypeConstants {
+public abstract class TagInfo {
     public static final int LENGTH_UNKNOWN = -1;
 
     public TagInfo(final String name, final int tag, final FieldType dataType, final int length,
@@ -80,7 +77,7 @@ public abstract class TagInfo implements
     }
 
     public Object getValue(final TiffField entry) throws ImageReadException {
-        final Object o = entry.fieldType.getSimpleValue(entry);
+        final Object o = entry.getFieldType().getValue(entry);
         return o;
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAny.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAny.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAny.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAny.java Wed Feb 13 18:40:52 2013
@@ -17,10 +17,11 @@
 package org.apache.commons.imaging.formats.tiff.taginfos;
 
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoAny extends TagInfo {
     public TagInfoAny(final String name, final int tag, final int length,
             final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_ANY, length, directoryType);
+        super(name, tag, FieldType.ANY, length, directoryType);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAscii.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAscii.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAscii.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAscii.java Wed Feb 13 18:40:52 2013
@@ -21,11 +21,12 @@ import java.io.UnsupportedEncodingExcept
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoAscii extends TagInfo {
     public TagInfoAscii(final String name, final int tag, final int length,
             final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_ASCII, length, directoryType);
+        super(name, tag, FieldType.ASCII, length, directoryType);
     }
 
     public String[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
@@ -67,6 +68,6 @@ public class TagInfoAscii extends TagInf
 
     public byte[] encodeValue(final ByteOrder byteOrder, final String... values)
             throws ImageWriteException {
-        return FIELD_TYPE_ASCII.writeData(values, byteOrder);
+        return FieldType.ASCII.writeData(values, byteOrder);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAsciiOrByte.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAsciiOrByte.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAsciiOrByte.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAsciiOrByte.java Wed Feb 13 18:40:52 2013
@@ -17,11 +17,12 @@
 package org.apache.commons.imaging.formats.tiff.taginfos;
 
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoAsciiOrByte extends TagInfo {
     public TagInfoAsciiOrByte(final String name, final int tag, final int length,
             final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_DESCRIPTION_ASCII_OR_BYTE, length,
+        super(name, tag, FieldType.ASCII_OR_BYTE, length,
                 directoryType, false);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAsciiOrRational.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAsciiOrRational.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAsciiOrRational.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAsciiOrRational.java Wed Feb 13 18:40:52 2013
@@ -17,11 +17,12 @@
 package org.apache.commons.imaging.formats.tiff.taginfos;
 
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoAsciiOrRational extends TagInfo {
     public TagInfoAsciiOrRational(final String name, final int tag, final int length,
             final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_DESCRIPTION_ASCII_OR_RATIONAL, length,
+        super(name, tag, FieldType.ASCII_OR_RATIONAL, length,
                 directoryType, false);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByte.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByte.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByte.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByte.java Wed Feb 13 18:40:52 2013
@@ -24,7 +24,7 @@ import org.apache.commons.imaging.format
 
 public class TagInfoByte extends TagInfo {
     public TagInfoByte(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_BYTE, length, directoryType);
+        super(name, tag, FieldType.BYTE, length, directoryType);
     }
     
     public TagInfoByte(final String name, final int tag, final List<FieldType> fieldTypes,
@@ -32,6 +32,11 @@ public class TagInfoByte extends TagInfo
         super(name, tag, fieldTypes, length, directoryType);
     }
 
+    public TagInfoByte(final String name, final int tag, final FieldType fieldType,
+            final int length, final TiffDirectoryType directoryType) {
+        super(name, tag, fieldType, length, directoryType);
+    }
+
     public byte[] encodeValue(final ByteOrder byteOrder, final byte... values) {
         return values;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByteOrShort.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByteOrShort.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByteOrShort.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByteOrShort.java Wed Feb 13 18:40:52 2013
@@ -19,10 +19,11 @@ package org.apache.commons.imaging.forma
 import org.apache.commons.imaging.common.ByteConversions;
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoByteOrShort extends TagInfo {
     public TagInfoByteOrShort(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_DESCRIPTION_BYTE_OR_SHORT, length, directoryType);
+        super(name, tag, FieldType.BYTE_OR_SHORT, length, directoryType);
     }
     
     public byte[] encodeValue(final ByteOrder byteOrder, final byte... values) {

Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDirectory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDirectory.java?rev=1445822&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDirectory.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDirectory.java Wed Feb 13 18:40:52 2013
@@ -0,0 +1,13 @@
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+
+/**
+ * A LONG representing an offset to a TIFF directory.
+ */
+public class TagInfoDirectory extends TagInfoLong {
+    public TagInfoDirectory(final String name, final int tag, final int length,
+            final TiffDirectoryType directoryType) {
+        super(name, tag, length, directoryType, true);
+    }
+}

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

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDouble.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDouble.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDouble.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDouble.java Wed Feb 13 18:40:52 2013
@@ -20,10 +20,11 @@ import org.apache.commons.imaging.ImageW
 import org.apache.commons.imaging.common.ByteConversions;
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoDouble extends TagInfo {
     public TagInfoDouble(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_DOUBLE, length, directoryType);
+        super(name, tag, FieldType.DOUBLE, length, directoryType);
     }
     
     public double[] getValue(final ByteOrder byteOrder, final byte[] bytes) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloat.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloat.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloat.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloat.java Wed Feb 13 18:40:52 2013
@@ -20,10 +20,11 @@ import org.apache.commons.imaging.ImageW
 import org.apache.commons.imaging.common.ByteConversions;
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoFloat extends TagInfo {
     public TagInfoFloat(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_FLOAT, length, directoryType);
+        super(name, tag, FieldType.FLOAT, length, directoryType);
     }
     
     public float[] getValue(final ByteOrder byteOrder, final byte[] bytes) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java Wed Feb 13 18:40:52 2013
@@ -27,10 +27,16 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 import org.apache.commons.imaging.util.Debug;
 
+/**
+ * Used by some GPS tags and the EXIF user comment tag,
+ * this badly documented value is meant to contain
+ * the text encoding in the first 8 bytes followed by
+ * the non-null-terminated text in an unknown byte order.  
+ */
 public final class TagInfoGpsText extends TagInfo {
-    public TagInfoGpsText(final String name, final int tag, final FieldType dataType, final int length,
+    public TagInfoGpsText(final String name, final int tag, final int length,
             final TiffDirectoryType exifDirectory) {
-        super(name, tag, dataType, length, exifDirectory);
+        super(name, tag, FieldType.UNDEFINED, length, exifDirectory);
     }
 
     @Override
@@ -40,43 +46,35 @@ public final class TagInfoGpsText extend
 
     private static final class TextEncoding {
         public final byte prefix[];
-        public final String encodingNameLE;
-        public final String encodingNameBE;
+        public final String encodingName;
 
-        public TextEncoding(final byte[] prefix, final String encodingNameLE,
-                final String encodingNameBE) {
+        public TextEncoding(final byte[] prefix, final String encodingName) {
             this.prefix = prefix;
-            this.encodingNameLE = encodingNameLE;
-            this.encodingNameBE = encodingNameBE;
-        }
-
-        public String getEncodingName(final ByteOrder byteOrder) {
-            if (byteOrder == ByteOrder.BIG_ENDIAN) {
-                return encodingNameBE;
-            } else {
-                return encodingNameLE;
-            }
+            this.encodingName = encodingName;
         }
     }
 
     private static final TagInfoGpsText.TextEncoding TEXT_ENCODING_ASCII = new TextEncoding(
             new byte[] { 0x41, 0x53, 0x43, 0x49, 0x49, 0x00, 0x00, 0x00, },
-            "US-ASCII", "US-ASCII"); // ITU-T T.50 IA5
+            "US-ASCII"); // ITU-T T.50 IA5
     private static final TagInfoGpsText.TextEncoding TEXT_ENCODING_JIS = new TextEncoding(
             new byte[] { 0x4A, 0x49, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, },
-            "JIS", "JIS"); // JIS X208-1990
-    private static final TagInfoGpsText.TextEncoding TEXT_ENCODING_UNICODE = new TextEncoding(
-            new byte[] { 0x55, 0x4E, 0x49, 0x43, 0x4F, 0x44, 0x45, 0x00,
-            // Which Unicode encoding to use, UTF-8?
-            }, "UTF-16LE", "UTF-16BE"); // Unicode Standard
+            "JIS"); // JIS X208-1990
+    private static final TagInfoGpsText.TextEncoding TEXT_ENCODING_UNICODE_LE = new TextEncoding(
+            new byte[] { 0x55, 0x4E, 0x49, 0x43, 0x4F, 0x44, 0x45, 0x00},
+            "UTF-16LE"); // Unicode Standard
+    private static final TagInfoGpsText.TextEncoding TEXT_ENCODING_UNICODE_BE = new TextEncoding(
+            new byte[] { 0x55, 0x4E, 0x49, 0x43, 0x4F, 0x44, 0x45, 0x00},
+            "UTF-16BE"); // Unicode Standard
     private static final TagInfoGpsText.TextEncoding TEXT_ENCODING_UNDEFINED = new TextEncoding(
-            new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+            new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
             // Try to interpret an undefined text as ISO-8859-1 (Latin)
-            }, "ISO-8859-1", "ISO-8859-1"); // Undefined
+            "ISO-8859-1"); // Undefined
     private static final TagInfoGpsText.TextEncoding TEXT_ENCODINGS[] = {
             TEXT_ENCODING_ASCII, //
             TEXT_ENCODING_JIS, //
-            TEXT_ENCODING_UNICODE, //
+            TEXT_ENCODING_UNICODE_LE, //
+            TEXT_ENCODING_UNICODE_BE, //
             TEXT_ENCODING_UNDEFINED, //
     };
 
@@ -91,10 +89,8 @@ public final class TagInfoGpsText extend
 
         try {
             // try ASCII, with NO prefix.
-            final byte asciiBytes[] = s.getBytes(TEXT_ENCODING_ASCII
-                    .getEncodingName(byteOrder));
-            final String decodedAscii = new String(asciiBytes,
-                    TEXT_ENCODING_ASCII.getEncodingName(byteOrder));
+            final byte asciiBytes[] = s.getBytes(TEXT_ENCODING_ASCII.encodingName);
+            final String decodedAscii = new String(asciiBytes, TEXT_ENCODING_ASCII.encodingName);
             if (decodedAscii.equals(s)) {
                 // no unicode/non-ascii values.
                 final byte result[] = new byte[asciiBytes.length
@@ -106,15 +102,19 @@ public final class TagInfoGpsText extend
                 return result;
             } else {
                 // use unicode
-                final byte unicodeBytes[] = s.getBytes(TEXT_ENCODING_UNICODE
-                        .getEncodingName(byteOrder));
-                final 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);
+                final TextEncoding encoding;
+                if (byteOrder == ByteOrder.BIG_ENDIAN) {
+                    encoding = TEXT_ENCODING_UNICODE_BE;
+                } else {
+                    encoding = TEXT_ENCODING_UNICODE_LE;
+                }
+                final byte unicodeBytes[] = s.getBytes(encoding.encodingName);
+                final byte result[] = new byte[unicodeBytes.length +
+                                               encoding.prefix.length];
+                System.arraycopy(encoding.prefix, 0,
+                        result, 0, encoding.prefix.length);
+                System.arraycopy(unicodeBytes, 0,
+                        result, encoding.prefix.length, unicodeBytes.length);
                 return result;
             }
         } catch (final UnsupportedEncodingException e) {
@@ -124,8 +124,8 @@ public final class TagInfoGpsText extend
 
     @Override
     public String getValue(final TiffField entry) throws ImageReadException {
-        if (entry.type == FIELD_TYPE_ASCII.type) {
-            final Object object = FIELD_TYPE_ASCII.getSimpleValue(entry);
+        if (entry.getFieldType() == FieldType.ASCII) {
+            final Object object = FieldType.ASCII.getValue(entry);
             if (object instanceof String) {
                 return (String) object;
             } else if (object instanceof String[]) {
@@ -138,19 +138,19 @@ public final class TagInfoGpsText extend
             } else {
                 throw new ImageReadException("Unexpected ASCII type decoded");
             }
-        } else if (entry.type == FIELD_TYPE_UNDEFINED.type) {
+        } else if (entry.getFieldType() == FieldType.UNDEFINED) {
             /* later */
-        } else if (entry.type == FIELD_TYPE_BYTE.type) {
+        } else if (entry.getFieldType() == FieldType.BYTE) {
             /* later */
         } else {
-            Debug.debug("entry.type", entry.type);
-            Debug.debug("entry.directoryType", entry.directoryType);
+            Debug.debug("entry.type", entry.getFieldType());
+            Debug.debug("entry.directoryType", entry.getDirectoryType());
             Debug.debug("entry.type", entry.getDescriptionWithoutValue());
-            Debug.debug("entry.type", entry.fieldType);
+            Debug.debug("entry.type", entry.getFieldType());
             throw new ImageReadException("GPS text field not encoded as bytes.");
         }
 
-        final byte bytes[] = entry.fieldType.getRawBytes(entry);
+        final byte bytes[] = entry.getByteArrayValue();
         if (bytes.length < 8) {
             try {
                 // try ASCII, with NO prefix.
@@ -165,9 +165,17 @@ public final class TagInfoGpsText extend
             if (BinaryFunctions.compareBytes(bytes, 0, encoding.prefix, 0,
                     encoding.prefix.length)) {
                 try {
-                    return new String(bytes, encoding.prefix.length,
+                    final String decodedString = new String(
+                            bytes, encoding.prefix.length,
                             bytes.length - encoding.prefix.length,
-                            encoding.getEncodingName(entry.byteOrder));
+                            encoding.encodingName);
+                    final byte[] reEncodedBytes = decodedString.getBytes(
+                            encoding.encodingName);
+                    if (BinaryFunctions.compareBytes(bytes, encoding.prefix.length,
+                            reEncodedBytes, 0,
+                            reEncodedBytes.length)) {
+                        return decodedString;
+                    }
                 } catch (final UnsupportedEncodingException e) {
                     throw new ImageReadException(e.getMessage(), e);
                 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLong.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLong.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLong.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLong.java Wed Feb 13 18:40:52 2013
@@ -19,15 +19,16 @@ package org.apache.commons.imaging.forma
 import org.apache.commons.imaging.common.ByteConversions;
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 
 public class TagInfoLong extends TagInfo {
     public TagInfoLong(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_LONG, length, directoryType);
+        super(name, tag, FieldType.LONG, length, directoryType);
     }
     
     public TagInfoLong(final String name, final int tag, final int length, final TiffDirectoryType directoryType, final boolean isOffset) {
-        super(name, tag, FIELD_TYPE_LONG, length, directoryType, isOffset);
+        super(name, tag, FieldType.LONG, length, directoryType, isOffset);
     }
     
     public int[] getValue(final ByteOrder byteOrder, final byte[] bytes) {

Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongOrIFD.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongOrIFD.java?rev=1445822&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongOrIFD.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongOrIFD.java Wed Feb 13 18:40:52 2013
@@ -0,0 +1,41 @@
+/*
+ * 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.imaging.formats.tiff.taginfos;
+
+import org.apache.commons.imaging.common.ByteConversions;
+import org.apache.commons.imaging.common.ByteOrder;
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+
+public class TagInfoLongOrIFD extends TagInfo {
+    public TagInfoLongOrIFD(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
+        super(name, tag, FieldType.LONG_OR_IFD, length, directoryType);
+    }
+    
+    public TagInfoLongOrIFD(final String name, final int tag, final int length, final TiffDirectoryType directoryType, final boolean isOffset) {
+        super(name, tag, FieldType.LONG_OR_IFD, length, directoryType, isOffset);
+    }
+    
+    public int[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
+        return ByteConversions.toInts(bytes, byteOrder);
+    }
+    
+    public byte[] encodeValue(final ByteOrder byteOrder, final int... values) {
+        return ByteConversions.toBytes(values, byteOrder);
+    }
+}

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

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRational.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRational.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRational.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRational.java Wed Feb 13 18:40:52 2013
@@ -20,10 +20,11 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.RationalNumber;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoRational extends TagInfo {
     public TagInfoRational(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_RATIONAL, length, directoryType);
+        super(name, tag, FieldType.RATIONAL, length, directoryType);
     }
 
     public RationalNumber[] getValue(final ByteOrder byteOrder, final byte[] bytes) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSByte.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSByte.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSByte.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSByte.java Wed Feb 13 18:40:52 2013
@@ -18,10 +18,11 @@ package org.apache.commons.imaging.forma
 
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoSByte extends TagInfo {
     public TagInfoSByte(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_SBYTE, length, directoryType);
+        super(name, tag, FieldType.SBYTE, length, directoryType);
     }
 
     public byte[] encodeValue(final ByteOrder byteOrder, final byte... values) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLong.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLong.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLong.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLong.java Wed Feb 13 18:40:52 2013
@@ -20,10 +20,11 @@ import org.apache.commons.imaging.ImageW
 import org.apache.commons.imaging.common.ByteConversions;
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoSLong extends TagInfo {
     public TagInfoSLong(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_SLONG, length, directoryType);
+        super(name, tag, FieldType.SLONG, length, directoryType);
     }
     
     public int[] getValue(final ByteOrder byteOrder, final byte[] bytes) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRational.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRational.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRational.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRational.java Wed Feb 13 18:40:52 2013
@@ -20,10 +20,11 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.RationalNumber;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoSRational extends TagInfo {
     public TagInfoSRational(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_SRATIONAL, length, directoryType);
+        super(name, tag, FieldType.SRATIONAL, length, directoryType);
     }
 
     public RationalNumber[] getValue(final ByteOrder byteOrder, final byte[] bytes) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java Wed Feb 13 18:40:52 2013
@@ -20,10 +20,11 @@ import org.apache.commons.imaging.ImageW
 import org.apache.commons.imaging.common.ByteConversions;
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoSShort extends TagInfo {
     public TagInfoSShort(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_SSHORT, length, directoryType);
+        super(name, tag, FieldType.SSHORT, length, directoryType);
     }
     
     public short[] getValue(final ByteOrder byteOrder, final byte[] bytes) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java Wed Feb 13 18:40:52 2013
@@ -19,10 +19,11 @@ package org.apache.commons.imaging.forma
 import org.apache.commons.imaging.common.ByteConversions;
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoShort extends TagInfo {
     public TagInfoShort(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_SHORT, length, directoryType);
+        super(name, tag, FieldType.SHORT, length, directoryType);
     }
     
     public short[] getValue(final ByteOrder byteOrder, final byte[] bytes) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLong.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLong.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLong.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLong.java Wed Feb 13 18:40:52 2013
@@ -19,14 +19,15 @@ package org.apache.commons.imaging.forma
 import org.apache.commons.imaging.common.ByteConversions;
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoShortOrLong extends TagInfo {
     public TagInfoShortOrLong(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, length, directoryType, false);
+        super(name, tag, FieldType.SHORT_OR_LONG, length, directoryType, false);
     }
     
     public TagInfoShortOrLong(final String name, final int tag, final int length, final TiffDirectoryType directoryType, final boolean isOffset) {
-        super(name, tag, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, length, directoryType, isOffset);
+        super(name, tag, FieldType.SHORT_OR_LONG, length, directoryType, isOffset);
     }
     
     public byte[] encodeValue(final ByteOrder byteOrder, final short... values) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLongOrRational.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLongOrRational.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLongOrRational.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrLongOrRational.java Wed Feb 13 18:40:52 2013
@@ -20,10 +20,11 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.RationalNumber;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoShortOrLongOrRational extends TagInfo {
     public TagInfoShortOrLongOrRational(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, length, directoryType);
+        super(name, tag, FieldType.SHORT_OR_LONG_OR_RATIONAL, length, directoryType);
     }
     
     public byte[] encodeValue(final ByteOrder byteOrder, final short... values) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrRational.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrRational.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrRational.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrRational.java Wed Feb 13 18:40:52 2013
@@ -20,10 +20,11 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.RationalNumber;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoShortOrRational extends TagInfo {
     public TagInfoShortOrRational(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, FIELD_TYPE_DESCRIPTION_SHORT_OR_RATIONAL, length, directoryType, false);
+        super(name, tag, FieldType.SHORT_OR_RATIONAL, length, directoryType, false);
     }
     
     public byte[] encodeValue(final ByteOrder byteOrder, final short... values) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java Wed Feb 13 18:40:52 2013
@@ -16,12 +16,11 @@
  */
 package org.apache.commons.imaging.formats.tiff.taginfos;
 
-import java.util.Arrays;
-
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
 public class TagInfoUndefined extends TagInfoByte {
     public TagInfoUndefined(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
-        super(name, tag, Arrays.asList(FIELD_TYPE_UNDEFINED), length, directoryType);
+        super(name, tag, FieldType.UNDEFINED, length, directoryType);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java Wed Feb 13 18:40:52 2013
@@ -16,16 +16,14 @@
  */
 package org.apache.commons.imaging.formats.tiff.taginfos;
 
-import java.util.Arrays;
-
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
+/**
+ * A TIFF tag whose definition isn't known.
+ */
 public final class TagInfoUnknown extends TagInfoByte {
     public TagInfoUnknown(final String name, final int tag, final int length, final TiffDirectoryType exifDirectory) {
-        super(name, tag, Arrays.asList(FIELD_TYPE_UNKNOWN), length, exifDirectory);
-    }
-
-    public boolean isUnknown() {
-        return true;
+        super(name, tag, FieldType.ANY, length, exifDirectory);
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java Wed Feb 13 18:40:52 2013
@@ -17,7 +17,6 @@
 package org.apache.commons.imaging.formats.tiff.taginfos;
 
 import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
@@ -34,8 +33,7 @@ import org.apache.commons.imaging.util.D
 public class TagInfoXpString extends TagInfo {
     public TagInfoXpString(final String name, final int tag, final int length,
             final TiffDirectoryType directoryType) {
-        super(name, tag, Arrays.asList(FIELD_TYPE_UNDEFINED), length,
-                directoryType);
+        super(name, tag, FieldType.BYTE, length, directoryType);
     }
 
     @Override
@@ -55,7 +53,7 @@ public class TagInfoXpString extends Tag
 
     @Override
     public String getValue(final TiffField entry) throws ImageReadException {
-        if (entry.type != FIELD_TYPE_BYTE.type) {
+        if (entry.getFieldType() != FieldType.BYTE) {
             throw new ImageReadException("Text field not encoded as bytes.");
         }
         try {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java?rev=1445822&r1=1445821&r2=1445822&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java Wed Feb 13 18:40:52 2013
@@ -588,7 +588,7 @@ public abstract class TiffImageWriterBas
     }
 
     protected void writeImageFileHeader(final BinaryOutputStream bos,
-            final int offsetToFirstIFD) throws IOException {
+            final long offsetToFirstIFD) throws IOException {
         if (byteOrder == ByteOrder.INTEL) {
             bos.write('I');
             bos.write('I');
@@ -599,7 +599,7 @@ public abstract class TiffImageWriterBas
 
         bos.write2Bytes(42); // tiffVersion
 
-        bos.write4Bytes(offsetToFirstIFD);
+        bos.write4Bytes((int)offsetToFirstIFD);
     }
 
 }



Mime
View raw message