commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1391794 [2/3] - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/common/ main/java/org/apache/commons/imaging/common/mylzw/ main/java/org/apache/commons/imaging/formats/bmp/ main/java/org/apache/commons/imaging/fo...
Date Sat, 29 Sep 2012 13:01:04 GMT
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java Sat Sep 29 13:01:01 2012
@@ -37,6 +37,7 @@ import org.apache.commons.imaging.ImageP
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.common.ImageBuilder;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
@@ -50,7 +51,7 @@ import org.apache.commons.imaging.util.P
 public class GifImageParser extends ImageParser {
 
     public GifImageParser() {
-        super.setByteOrder(BYTE_ORDER_LSB);
+        super.setByteOrder(ByteOrder.LITTLE_ENDIAN);
     }
 
     @Override
@@ -384,7 +385,7 @@ public class GifImageParser extends Imag
 
             int size = imageWidth * imageHeight;
             MyLzwDecompressor myLzwDecompressor = new MyLzwDecompressor(
-                    LZWMinimumCodeSize, BYTE_ORDER_LSB);
+                    LZWMinimumCodeSize, ByteOrder.LITTLE_ENDIAN);
             imageData = myLzwDecompressor.decompress(bais, size);
         } else {
             int LZWMinimumCodeSize = is.read();
@@ -844,7 +845,7 @@ public class GifImageParser extends Imag
         }
         int palette_size = palette2.length() + (hasAlpha ? 1 : 0);
 
-        BinaryOutputStream bos = new BinaryOutputStream(os, BYTE_ORDER_LSB);
+        BinaryOutputStream bos = new BinaryOutputStream(os, ByteOrder.LITTLE_ENDIAN);
 
         // write Header
         os.write(0x47); // G magic numbers
@@ -992,7 +993,7 @@ public class GifImageParser extends Imag
             bos.write(LZWMinimumCodeSize);
 
             MyLzwCompressor compressor = new MyLzwCompressor(
-                    LZWMinimumCodeSize, BYTE_ORDER_LSB, false); // GIF
+                    LZWMinimumCodeSize, ByteOrder.LITTLE_ENDIAN, false); // GIF
             // Mode);
 
             byte imagedata[] = new byte[width * height];

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java Sat Sep 29 13:01:01 2012
@@ -34,6 +34,7 @@ import org.apache.commons.imaging.ImageP
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.util.Debug;
@@ -43,7 +44,7 @@ public class IcnsImageParser extends Ima
     public static final int ICNS_MAGIC = IcnsType.typeAsInt("icns");
 
     public IcnsImageParser() {
-        super.setByteOrder(BYTE_ORDER_MSB);
+        super.setByteOrder(ByteOrder.BIG_ENDIAN);
     }
 
     @Override
@@ -326,7 +327,7 @@ public class IcnsImageParser extends Ima
         }
 
         BinaryOutputStream bos = new BinaryOutputStream(os,
-                BYTE_ORDER_BIG_ENDIAN);
+                ByteOrder.BIG_ENDIAN);
         bos.write4Bytes(ICNS_MAGIC);
         bos.write4Bytes(4 + 4 + 4 + 4 + 4 * imageType.getWidth()
                 * imageType.getHeight() + 4 + 4 + imageType.getWidth()

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java Sat Sep 29 13:01:01 2012
@@ -38,6 +38,7 @@ import org.apache.commons.imaging.ImageW
 import org.apache.commons.imaging.Imaging;
 import org.apache.commons.imaging.PixelDensity;
 import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.formats.bmp.BmpImageParser;
@@ -48,7 +49,7 @@ import org.apache.commons.imaging.util.D
 public class IcoImageParser extends ImageParser {
 
     public IcoImageParser() {
-        super.setByteOrder(BYTE_ORDER_LSB);
+        super.setByteOrder(ByteOrder.LITTLE_ENDIAN);
     }
 
     @Override
@@ -436,7 +437,7 @@ public class IcoImageParser extends Imag
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream(bitmapSize);
         BinaryOutputStream bos = new BinaryOutputStream(baos,
-                BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
+                ByteOrder.LITTLE_ENDIAN);
 
         bos.write('B');
         bos.write('M');
@@ -683,7 +684,7 @@ public class IcoImageParser extends Imag
             bitCount = 8;
         }
 
-        BinaryOutputStream bos = new BinaryOutputStream(os, BYTE_ORDER_INTEL);
+        BinaryOutputStream bos = new BinaryOutputStream(os, ByteOrder.INTEL);
 
         int scanline_size = (bitCount * src.getWidth() + 7) / 8;
         if ((scanline_size % 4) != 0) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java Sat Sep 29 13:01:01 2012
@@ -34,6 +34,7 @@ import org.apache.commons.imaging.ImageF
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.ImageParser;
 import org.apache.commons.imaging.ImageReadException;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.formats.jpeg.decoder.JpegDecoder;
@@ -58,7 +59,7 @@ import org.apache.commons.imaging.util.D
 
 public class JpegImageParser extends ImageParser implements JpegConstants {
     public JpegImageParser() {
-        setByteOrder(BYTE_ORDER_NETWORK);
+        setByteOrder(ByteOrder.BIG_ENDIAN);
         // setDebug(true);
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java Sat Sep 29 13:01:01 2012
@@ -21,12 +21,13 @@ import java.io.InputStream;
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.common.BinaryFileParser;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.util.Debug;
 
 public class JpegUtils extends BinaryFileParser implements JpegConstants {
     public JpegUtils() {
-        setByteOrder(BYTE_ORDER_NETWORK);
+        setByteOrder(ByteOrder.NETWORK);
     }
 
     public static interface Visitor {
@@ -55,7 +56,7 @@ public class JpegUtils extends BinaryFil
             readAndVerifyBytes(is, SOI,
                     "Not a Valid JPEG File: doesn't begin with 0xffd8");
 
-            int byteOrder = getByteOrder();
+            ByteOrder byteOrder = getByteOrder();
 
             int markerCount;
             for (markerCount = 0; true; markerCount++) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java Sat Sep 29 13:01:01 2012
@@ -27,6 +27,7 @@ import java.util.List;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.common.BinaryFileParser;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.common.bytesource.ByteSourceArray;
 import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
@@ -54,7 +55,7 @@ public class ExifRewriter extends Binary
      * extension.
      */
     public ExifRewriter() {
-        setByteOrder(BYTE_ORDER_NETWORK);
+        setByteOrder(ByteOrder.NETWORK);
     }
 
     /**
@@ -67,7 +68,7 @@ public class ExifRewriter extends Binary
      * 
      * @see org.apache.commons.imaging.common.BinaryConstants
      */
-    public ExifRewriter(int byteOrder) {
+    public ExifRewriter(ByteOrder byteOrder) {
         setByteOrder(byteOrder);
     }
 
@@ -498,7 +499,7 @@ public class ExifRewriter extends Binary
     private void writeSegmentsReplacingExif(OutputStream os,
             List<JFIFPiece> segments, byte newBytes[])
             throws ImageWriteException, IOException {
-        int byteOrder = getByteOrder();
+        ByteOrder byteOrder = getByteOrder();
 
         try {
             SOI.writeTo(os);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java Sat Sep 29 13:01:01 2012
@@ -31,14 +31,15 @@ import org.apache.commons.imaging.Imagin
 import org.apache.commons.imaging.common.BinaryFileParser;
 import org.apache.commons.imaging.common.BinaryInputStream;
 import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.util.Debug;
 import org.apache.commons.imaging.util.ParamMap;
 
 public class IptcParser extends BinaryFileParser implements IptcConstants {
-    private static final int APP13_BYTE_ORDER = BYTE_ORDER_NETWORK;
+    private static final ByteOrder APP13_BYTE_ORDER = ByteOrder.NETWORK;
 
     public IptcParser() {
-        setByteOrder(BYTE_ORDER_NETWORK);
+        setByteOrder(ByteOrder.NETWORK);
     }
 
     public boolean isPhotoshopJpegSegment(byte segmentData[]) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java Sat Sep 29 13:01:01 2012
@@ -24,6 +24,7 @@ import java.util.List;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.common.BinaryFileParser;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.formats.jpeg.JpegConstants;
 import org.apache.commons.imaging.formats.jpeg.JpegUtils;
@@ -33,7 +34,7 @@ import org.apache.commons.imaging.format
  * Interface for Exif write/update/remove functionality for Jpeg/JFIF images.
  */
 public class JpegRewriter extends BinaryFileParser implements JpegConstants {
-    private static final int JPEG_BYTE_ORDER = BYTE_ORDER_NETWORK;
+    private static final ByteOrder JPEG_BYTE_ORDER = ByteOrder.NETWORK;
 
     /**
      * Constructor. to guess whether a file contains an image based on its file

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpParser.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpParser.java Sat Sep 29 13:01:01 2012
@@ -21,12 +21,13 @@ import java.io.UnsupportedEncodingExcept
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.common.BinaryFileParser;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.jpeg.JpegConstants;
 
 public class JpegXmpParser extends BinaryFileParser implements JpegConstants {
 
     public JpegXmpParser() {
-        setByteOrder(BYTE_ORDER_NETWORK);
+        setByteOrder(ByteOrder.NETWORK);
     }
 
     public boolean isXmpJpegSegment(byte segmentData[]) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java Sat Sep 29 13:01:01 2012
@@ -42,6 +42,7 @@ import org.apache.commons.imaging.ImageI
 import org.apache.commons.imaging.ImageParser;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 
@@ -59,7 +60,7 @@ public class PcxImageParser extends Imag
     // images properly.
 
     public PcxImageParser() {
-        super.setByteOrder(BYTE_ORDER_LSB);
+        super.setByteOrder(ByteOrder.LITTLE_ENDIAN);
     }
 
     @Override
@@ -261,17 +262,17 @@ public class PcxImageParser extends Imag
         int encoding = 0xff & pcxHeaderBytes[2];
         int bitsPerPixel = 0xff & pcxHeaderBytes[3];
         int xMin = convertByteArrayToShort("xMin", 4, pcxHeaderBytes,
-                BYTE_ORDER_LSB);
+                ByteOrder.LITTLE_ENDIAN);
         int yMin = convertByteArrayToShort("yMin", 6, pcxHeaderBytes,
-                BYTE_ORDER_LSB);
+                ByteOrder.LITTLE_ENDIAN);
         int xMax = convertByteArrayToShort("xMax", 8, pcxHeaderBytes,
-                BYTE_ORDER_LSB);
+                ByteOrder.LITTLE_ENDIAN);
         int yMax = convertByteArrayToShort("yMax", 10, pcxHeaderBytes,
-                BYTE_ORDER_LSB);
+                ByteOrder.LITTLE_ENDIAN);
         int hDpi = convertByteArrayToShort("hDpi", 12, pcxHeaderBytes,
-                BYTE_ORDER_LSB);
+                ByteOrder.LITTLE_ENDIAN);
         int vDpi = convertByteArrayToShort("vDpi", 14, pcxHeaderBytes,
-                BYTE_ORDER_LSB);
+                ByteOrder.LITTLE_ENDIAN);
         int[] colormap = new int[16];
         for (int i = 0; i < 16; i++) {
             colormap[i] = 0xff000000
@@ -282,13 +283,13 @@ public class PcxImageParser extends Imag
         int reserved = 0xff & pcxHeaderBytes[64];
         int nPlanes = 0xff & pcxHeaderBytes[65];
         int bytesPerLine = convertByteArrayToShort("BytesPerLine", 66,
-                pcxHeaderBytes, BYTE_ORDER_LSB);
+                pcxHeaderBytes, ByteOrder.LITTLE_ENDIAN);
         int paletteInfo = convertByteArrayToShort("PaletteInfo", 68,
-                pcxHeaderBytes, BYTE_ORDER_LSB);
+                pcxHeaderBytes, ByteOrder.LITTLE_ENDIAN);
         int hScreenSize = convertByteArrayToShort("hScreenSize", 70,
-                pcxHeaderBytes, BYTE_ORDER_LSB);
+                pcxHeaderBytes, ByteOrder.LITTLE_ENDIAN);
         int vScreenSize = convertByteArrayToShort("vScreenSize", 72,
-                pcxHeaderBytes, BYTE_ORDER_LSB);
+                pcxHeaderBytes, ByteOrder.LITTLE_ENDIAN);
 
         if (manufacturer != 10) {
             throw new ImageReadException(

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java Sat Sep 29 13:01:01 2012
@@ -25,6 +25,7 @@ import java.util.Map;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.PixelDensity;
 import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.palette.PaletteFactory;
 import org.apache.commons.imaging.palette.SimplePalette;
 
@@ -138,7 +139,7 @@ public class PcxWriter implements PcxCon
         final SimplePalette palette = paletteFactory
                 .makeExactRgbPaletteSimple(src, 256);
         BinaryOutputStream bos = new BinaryOutputStream(os,
-                BinaryOutputStream.BYTE_ORDER_INTEL);
+                ByteOrder.INTEL);
         if (palette == null || bitDepth == 24 || bitDepth == 32) {
             if (bitDepth == 32) {
                 write32BppPCX(src, bos);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java Sat Sep 29 13:01:01 2012
@@ -33,6 +33,7 @@ import org.apache.commons.imaging.ImageI
 import org.apache.commons.imaging.ImageParser;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.common.ImageBuilder;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
@@ -41,7 +42,7 @@ import org.apache.commons.imaging.util.D
 public class PnmImageParser extends ImageParser implements PnmConstants {
 
     public PnmImageParser() {
-        super.setByteOrder(BYTE_ORDER_LSB);
+        super.setByteOrder(ByteOrder.LITTLE_ENDIAN);
         // setDebug(true);
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java Sat Sep 29 13:01:01 2012
@@ -32,6 +32,7 @@ import org.apache.commons.imaging.ImageF
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.ImageParser;
 import org.apache.commons.imaging.ImageReadException;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.formats.psd.dataparsers.DataParser;
@@ -49,7 +50,7 @@ import org.apache.commons.imaging.util.D
 public class PsdImageParser extends ImageParser {
 
     public PsdImageParser() {
-        super.setByteOrder(BYTE_ORDER_MSB);
+        super.setByteOrder(ByteOrder.MOTOROLA);
         // setDebug(true);
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java Sat Sep 29 13:01:01 2012
@@ -23,6 +23,7 @@ import java.io.InputStream;
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.common.BinaryFileParser;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.PackBits;
 import org.apache.commons.imaging.common.mylzw.BitsToByteInputStream;
 import org.apache.commons.imaging.common.mylzw.MyBitInputStream;
@@ -70,7 +71,7 @@ public class CompressedDataReader extend
                 byte unpacked[] = new PackBits().decompress(packed, width);
                 InputStream bais = new ByteArrayInputStream(unpacked);
                 MyBitInputStream mbis = new MyBitInputStream(bais,
-                        BYTE_ORDER_MSB);
+                        ByteOrder.MOTOROLA);
                 BitsToByteInputStream bbis = new BitsToByteInputStream(mbis, 8); // we
                                                                                  // want
                                                                                  // all

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.java Sat Sep 29 13:01:01 2012
@@ -21,12 +21,11 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.commons.imaging.ImageReadException;
-import org.apache.commons.imaging.common.BinaryConstants;
 import org.apache.commons.imaging.common.BinaryFileParser;
 import org.apache.commons.imaging.formats.psd.ImageContents;
 import org.apache.commons.imaging.formats.psd.dataparsers.DataParser;
 
-public abstract class DataReader implements BinaryConstants {
+public abstract class DataReader {
     protected final DataParser dataParser;
 
     public DataReader(DataParser fDataParser) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java Sat Sep 29 13:01:01 2012
@@ -22,6 +22,7 @@ import java.io.InputStream;
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.common.BinaryFileParser;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.mylzw.BitsToByteInputStream;
 import org.apache.commons.imaging.common.mylzw.MyBitInputStream;
 import org.apache.commons.imaging.formats.psd.ImageContents;
@@ -45,7 +46,7 @@ public class UncompressedDataReader exte
 
         int channel_count = dataParser.getBasicChannelsCount();
         int depth = header.Depth;
-        MyBitInputStream mbis = new MyBitInputStream(is, BYTE_ORDER_MSB);
+        MyBitInputStream mbis = new MyBitInputStream(is, ByteOrder.MOTOROLA);
         // we want all samples to be bytes
         BitsToByteInputStream bbis = new BitsToByteInputStream(mbis, 8);
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java Sat Sep 29 13:01:01 2012
@@ -35,7 +35,7 @@ import org.apache.commons.imaging.ImageF
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.ImageParser;
 import org.apache.commons.imaging.ImageReadException;
-import org.apache.commons.imaging.common.BinaryConstants;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 
@@ -47,7 +47,7 @@ import org.apache.commons.imaging.common
 public class RgbeImageParser extends ImageParser {
 
     public RgbeImageParser() {
-        setByteOrder(BinaryConstants.BYTE_ORDER_BIG_ENDIAN);
+        setByteOrder(ByteOrder.BIG_ENDIAN);
     }
 
     @Override

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java Sat Sep 29 13:01:01 2012
@@ -22,9 +22,9 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.apache.commons.imaging.ImageReadException;
-import org.apache.commons.imaging.common.BinaryConstants;
 import org.apache.commons.imaging.common.BinaryFileFunctions;
 import org.apache.commons.imaging.common.BinaryInputStream;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
@@ -42,7 +42,7 @@ class RgbeInfo extends BinaryFileFunctio
 
     RgbeInfo(ByteSource byteSource) throws IOException {
         this.in = new BinaryInputStream(byteSource.getInputStream(),
-                BinaryConstants.BYTE_ORDER_BIG_ENDIAN);
+                ByteOrder.BIG_ENDIAN);
     }
 
     IImageMetadata getMetadata() throws IOException, ImageReadException {
@@ -142,7 +142,7 @@ class RgbeInfo extends BinaryFileFunctio
         }
 
         byte[] scanLineBytes = convertShortToByteArray(width,
-                BinaryConstants.BYTE_ORDER_BIG_ENDIAN);
+                ByteOrder.BIG_ENDIAN);
         byte[] rgbe = new byte[width * 4];
         float[][] out = new float[3][width * height];
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java Sat Sep 29 13:01:01 2012
@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.imaging.ImageReadException;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.RationalNumber;
 import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
 import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants;
@@ -146,13 +147,13 @@ public class TiffDirectory extends TiffE
         return false;
     }
 
-    public BufferedImage getTiffImage(int byteOrder) throws ImageReadException,
+    public BufferedImage getTiffImage(ByteOrder byteOrder) throws ImageReadException,
             IOException {
         Map<String,Object> params = null;
         return getTiffImage(byteOrder, params);
     }
 
-    public BufferedImage getTiffImage(int byteOrder, Map<String,Object> params)
+    public BufferedImage getTiffImage(ByteOrder byteOrder, Map<String,Object> params)
             throws ImageReadException, IOException {
         if (null == tiffImageData) {
             return null;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java Sat Sep 29 13:01:01 2012
@@ -29,6 +29,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.imaging.ImageReadException;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.formats.tiff.constants.ExifTagConstants;
 import org.apache.commons.imaging.formats.tiff.constants.GpsTagConstants;
@@ -50,10 +51,10 @@ public class TiffField implements TiffCo
     public final byte valueOffsetBytes[];
 
     public byte oversizeValue[] = null;
-    public final int byteOrder;
+    public final ByteOrder byteOrder;
 
     public TiffField(int tag, int directoryType, int type, int Length,
-            int ValueOffset, byte ValueOffsetBytes[], int byteOrder) {
+            int ValueOffset, byte ValueOffsetBytes[], ByteOrder byteOrder) {
 
         this.tag = tag;
         this.directoryType = directoryType;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffHeader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffHeader.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffHeader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffHeader.java Sat Sep 29 13:01:01 2012
@@ -16,14 +16,15 @@
  */
 package org.apache.commons.imaging.formats.tiff;
 
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
 
 public class TiffHeader extends TiffElement {
-    public final int byteOrder;
+    public final ByteOrder byteOrder;
     public final int tiffVersion;
     public final int offsetToFirstIFD;
 
-    public TiffHeader(final int byteOrder, int tiffVersion, int offsetToFirstIFD) {
+    public TiffHeader(final ByteOrder byteOrder, int tiffVersion, int offsetToFirstIFD) {
         super(0, TiffConstants.TIFF_HEADER_SIZE);
 
         this.byteOrder = byteOrder;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java Sat Sep 29 13:01:01 2012
@@ -20,6 +20,7 @@ package org.apache.commons.imaging.forma
 import java.io.IOException;
 
 import org.apache.commons.imaging.ImageReadException;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
 import org.apache.commons.imaging.formats.tiff.datareaders.DataReader;
 import org.apache.commons.imaging.formats.tiff.datareaders.DataReaderStrips;
@@ -55,7 +56,7 @@ public abstract class TiffImageData {
                 PhotometricInterpreter photometricInterpreter,
                 int bitsPerPixel, int bitsPerSample[], int predictor,
                 int samplesPerPixel, int width, int height, int compression,
-                int byteOrder) throws IOException, ImageReadException {
+                ByteOrder byteOrder) throws IOException, ImageReadException {
             return new DataReaderTiled(directory, photometricInterpreter,
                     tileWidth, tileLength, bitsPerPixel, bitsPerSample,
                     predictor, samplesPerPixel, width, height, compression,
@@ -94,7 +95,7 @@ public abstract class TiffImageData {
                 PhotometricInterpreter photometricInterpreter,
                 int bitsPerPixel, int bitsPerSample[], int predictor,
                 int samplesPerPixel, int width, int height, int compression,
-                int byteorder) throws IOException, ImageReadException {
+                ByteOrder byteorder) throws IOException, ImageReadException {
             return new DataReaderStrips(directory, photometricInterpreter,
                     bitsPerPixel, bitsPerSample, predictor, samplesPerPixel,
                     width, height, compression, byteorder, rowsPerStrip, this);
@@ -116,7 +117,7 @@ public abstract class TiffImageData {
     public abstract DataReader getDataReader(TiffDirectory directory,
             PhotometricInterpreter photometricInterpreter, int bitsPerPixel,
             int bitsPerSample[], int predictor, int samplesPerPixel, int width,
-            int height, int compression, int byteOrder) throws IOException,
+            int height, int compression, ByteOrder byteOrder) throws IOException,
             ImageReadException;
 
     public static class Data extends TiffElement.DataElement {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java Sat Sep 29 13:01:01 2012
@@ -25,6 +25,7 @@ import java.util.Map;
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.common.RationalNumber;
 import org.apache.commons.imaging.formats.tiff.constants.AllTagConstants;
@@ -83,9 +84,9 @@ public class TiffImageMetadata extends I
         public final int type;
 
         private final TiffDirectory directory;
-        private final int byteOrder;
+        private final ByteOrder byteOrder;
 
-        public Directory(int byteOrder, final TiffDirectory directory) {
+        public Directory(ByteOrder byteOrder, final TiffDirectory directory) {
             this.type = directory.type;
             this.directory = directory;
             this.byteOrder = byteOrder;
@@ -125,7 +126,7 @@ public class TiffImageMetadata extends I
                     + "\n" + super.toString(prefix) + "\n";
         }
 
-        public TiffOutputDirectory getOutputDirectory(int byteOrder)
+        public TiffOutputDirectory getOutputDirectory(ByteOrder byteOrder)
                 throws ImageWriteException {
             try {
                 TiffOutputDirectory dstDir = new TiffOutputDirectory(type,
@@ -215,7 +216,7 @@ public class TiffImageMetadata extends I
     }
 
     public TiffOutputSet getOutputSet() throws ImageWriteException {
-        int byteOrder = contents.header.byteOrder;
+        ByteOrder byteOrder = contents.header.byteOrder;
         TiffOutputSet result = new TiffOutputSet(byteOrder);
 
         List<? extends IImageMetadataItem> srcDirs = getDirectories();

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java Sat Sep 29 13:01:01 2012
@@ -33,6 +33,7 @@ import org.apache.commons.imaging.ImageI
 import org.apache.commons.imaging.ImageParser;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.common.ImageBuilder;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
@@ -441,7 +442,7 @@ public class TiffImageParser extends Ima
         TiffReader reader = new TiffReader(isStrict(params));
         TiffContents contents = reader.readFirstDirectory(byteSource, params,
                 true, formatCompliance);
-        int byteOrder = reader.getByteOrder();
+        ByteOrder byteOrder = reader.getByteOrder();
         TiffDirectory directory = contents.directories.get(0);
         BufferedImage result = directory.getTiffImage(byteOrder, params);
         if (null == result) {
@@ -470,7 +471,7 @@ public class TiffImageParser extends Ima
     }
 
     protected BufferedImage getBufferedImage(TiffDirectory directory,
-            int byteOrder, Map<String,Object> params) throws ImageReadException, IOException {
+            ByteOrder byteOrder, Map<String,Object> params) throws ImageReadException, IOException {
         List<TiffField> entries = directory.entries;
 
         if (entries == null) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java Sat Sep 29 13:01:01 2012
@@ -25,6 +25,7 @@ import java.util.Map;
 import org.apache.commons.imaging.FormatCompliance;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.common.BinaryFileParser;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
 import org.apache.commons.imaging.formats.tiff.TiffDirectory.ImageDataElement;
@@ -58,13 +59,28 @@ public class TiffReader extends BinaryFi
             }
         }
     }
+    
+    private ByteOrder getTiffByteOrder(int byteOrderByte) throws ImageReadException {
+        if (byteOrderByte == 'I') {
+            return ByteOrder.INTEL;
+        } else if (byteOrderByte == 'M') {
+            return ByteOrder.MOTOROLA;
+        } else {
+            throw new ImageReadException("Invalid TIFF byte order " + (0xff & byteOrderByte));
+        }
+    }
 
     private TiffHeader readTiffHeader(InputStream is,
             FormatCompliance formatCompliance) throws ImageReadException,
             IOException {
         int BYTE_ORDER_1 = readByte("BYTE_ORDER_1", is, "Not a Valid TIFF File");
         int BYTE_ORDER_2 = readByte("BYTE_ORDER_2", is, "Not a Valid TIFF File");
-        setByteOrder(BYTE_ORDER_1, BYTE_ORDER_2);
+        if (BYTE_ORDER_1 != BYTE_ORDER_2) {
+            throw new ImageReadException("Byte Order bytes don't match (" + BYTE_ORDER_1
+                    + ", " + BYTE_ORDER_2 + ").");
+        }
+        ByteOrder byteOrder = getTiffByteOrder(BYTE_ORDER_1);
+        setByteOrder(byteOrder);
 
         int tiffVersion = read2Bytes("tiffVersion", is, "Not a Valid TIFF File");
         if (tiffVersion != 42) {
@@ -81,7 +97,7 @@ public class TiffReader extends BinaryFi
             System.out.println("");
         }
 
-        return new TiffHeader(BYTE_ORDER_1, tiffVersion, offsetToFirstIFD);
+        return new TiffHeader(byteOrder, tiffVersion, offsetToFirstIFD);
     }
 
     private void readDirectories(ByteSource byteSource,

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -17,16 +17,15 @@
 package org.apache.commons.imaging.formats.tiff.constants;
 
 import org.apache.commons.imaging.ImagingConstants;
-import org.apache.commons.imaging.common.BinaryConstants;
+import org.apache.commons.imaging.common.ByteOrder;
 
 public interface TiffConstants
         extends
             ImagingConstants,
             TiffFieldTypeConstants,
             TiffDirectoryConstants,
-            AllTagConstants,
-            BinaryConstants {
-    public static final int DEFAULT_TIFF_BYTE_ORDER = BYTE_ORDER_INTEL;
+            AllTagConstants {
+    public static final ByteOrder DEFAULT_TIFF_BYTE_ORDER = ByteOrder.INTEL;
 
     public static final int TIFF_HEADER_SIZE = 8;
     public static final int TIFF_DIRECTORY_HEADER_LENGTH = 2;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReader.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReader.java Sat Sep 29 13:01:01 2012
@@ -21,8 +21,8 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.commons.imaging.ImageReadException;
-import org.apache.commons.imaging.common.BinaryConstants;
 import org.apache.commons.imaging.common.BitInputStream;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.ImageBuilder;
 import org.apache.commons.imaging.common.PackBits;
 import org.apache.commons.imaging.common.itu_t4.T4AndT6Compression;
@@ -33,7 +33,7 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants;
 import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreter;
 
-public abstract class DataReader implements TiffConstants, BinaryConstants {
+public abstract class DataReader implements TiffConstants {
     protected final TiffDirectory directory;
     protected final PhotometricInterpreter photometricInterpreter;
     protected final int bitsPerSample[];
@@ -178,7 +178,7 @@ public abstract class DataReader impleme
             int LZWMinimumCodeSize = 8;
 
             MyLzwDecompressor myLzwDecompressor = new MyLzwDecompressor(
-                    LZWMinimumCodeSize, BYTE_ORDER_NETWORK);
+                    LZWMinimumCodeSize, ByteOrder.NETWORK);
 
             myLzwDecompressor.setTiffLZWMode();
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java Sat Sep 29 13:01:01 2012
@@ -21,6 +21,7 @@ import java.io.IOException;
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.common.BitInputStream;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.ImageBuilder;
 import org.apache.commons.imaging.formats.tiff.TiffDirectory;
 import org.apache.commons.imaging.formats.tiff.TiffImageData;
@@ -32,14 +33,14 @@ public final class DataReaderStrips exte
     private final int bitsPerPixel;
     private final int compression;
     private final int rowsPerStrip;
-    private final int byteOrder;
+    private final ByteOrder byteOrder;
 
     private final TiffImageData.Strips imageData;
 
     public DataReaderStrips(TiffDirectory directory,
             PhotometricInterpreter photometricInterpreter, int bitsPerPixel,
             int bitsPerSample[], int predictor, int samplesPerPixel, int width,
-            int height, int compression, int byteOrder, int rowsPerStrip,
+            int height, int compression, ByteOrder byteOrder, int rowsPerStrip,
             TiffImageData.Strips imageData) {
         super(directory, photometricInterpreter, bitsPerSample, predictor,
                 samplesPerPixel, width, height);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java Sat Sep 29 13:01:01 2012
@@ -21,6 +21,7 @@ import java.io.IOException;
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.common.BitInputStream;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.ImageBuilder;
 import org.apache.commons.imaging.formats.tiff.TiffDirectory;
 import org.apache.commons.imaging.formats.tiff.TiffImageData;
@@ -35,7 +36,7 @@ public final class DataReaderTiled exten
     private final int bitsPerPixel;
 
     private final int compression;
-    private final int byteOrder;
+    private final ByteOrder byteOrder;
 
     private final TiffImageData.Tiles imageData;
 
@@ -43,7 +44,7 @@ public final class DataReaderTiled exten
             PhotometricInterpreter photometricInterpreter, int tileWidth,
             int tileLength, int bitsPerPixel, int bitsPerSample[],
             int predictor, int samplesPerPixel, int width, int height,
-            int compression, int byteOrder, TiffImageData.Tiles imageData) {
+            int compression, ByteOrder byteOrder, TiffImageData.Tiles imageData) {
         super(directory, photometricInterpreter, bitsPerSample, predictor,
                 samplesPerPixel, width, height);
 

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -19,6 +19,7 @@ package org.apache.commons.imaging.forma
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.common.BinaryFileFunctions;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.TiffField;
 import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
 
@@ -105,7 +106,7 @@ public abstract class FieldType extends 
                 + name + ", length: " + length + "]";
     }
 
-    public abstract byte[] writeData(Object o, int byteOrder)
+    public abstract byte[] writeData(Object o, ByteOrder byteOrder)
             throws ImageWriteException;
 
 }

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -19,6 +19,7 @@ package org.apache.commons.imaging.forma
 import java.io.UnsupportedEncodingException;
 
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.TiffField;
 
 public class FieldTypeAscii extends FieldType {
@@ -72,7 +73,7 @@ public class FieldTypeAscii extends Fiel
     }
 
     @Override
-    public byte[] writeData(Object o, int byteOrder) throws ImageWriteException {
+    public byte[] writeData(Object o, ByteOrder byteOrder) throws ImageWriteException {
         if (o instanceof byte[]) {
             byte bytes[] = (byte[]) o;
             byte result[] = new byte[bytes.length + 1];

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -17,6 +17,7 @@
 package org.apache.commons.imaging.formats.tiff.fieldtypes;
 
 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.util.Debug;
 
@@ -35,7 +36,7 @@ public class FieldTypeByte extends Field
     }
 
     @Override
-    public byte[] writeData(Object o, int byteOrder) throws ImageWriteException {
+    public byte[] writeData(Object o, ByteOrder byteOrder) throws ImageWriteException {
         if (o instanceof Byte) {
             return new byte[] { ((Byte) o).byteValue(), };
         } else if (o instanceof byte[]) {

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -17,6 +17,8 @@
 package org.apache.commons.imaging.formats.tiff.fieldtypes;
 
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.common.BinaryConversions;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.TiffField;
 import org.apache.commons.imaging.util.Debug;
 
@@ -31,20 +33,20 @@ public class FieldTypeDouble extends Fie
     }
 
     @Override
-    public byte[] writeData(Object o, int byteOrder) throws ImageWriteException {
+    public byte[] writeData(Object o, ByteOrder byteOrder) throws ImageWriteException {
         if (o instanceof Double) {
-            return convertDoubleToByteArray(((Double) o).doubleValue(),
+            return BinaryConversions.toBytes(((Double) o).doubleValue(),
                     byteOrder);
         } else if (o instanceof double[]) {
             double numbers[] = (double[]) o;
-            return convertDoubleArrayToByteArray(numbers, byteOrder);
+            return BinaryConversions.toBytes(numbers, byteOrder);
         } else if (o instanceof Double[]) {
             Double numbers[] = (Double[]) o;
             double values[] = new double[numbers.length];
             for (int i = 0; i < values.length; i++) {
                 values[i] = numbers[i].doubleValue();
             }
-            return convertDoubleArrayToByteArray(values, byteOrder);
+            return BinaryConversions.toBytes(values, byteOrder);
         } else {
             throw new ImageWriteException("Invalid data: " + o + " ("
                     + Debug.getType(o) + ")");

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -17,6 +17,8 @@
 package org.apache.commons.imaging.formats.tiff.fieldtypes;
 
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.common.BinaryConversions;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.TiffField;
 import org.apache.commons.imaging.util.Debug;
 
@@ -30,29 +32,29 @@ public class FieldTypeFloat extends Fiel
     @Override
     public Object getSimpleValue(TiffField entry) {
         if (entry.length == 1) {
-            return new Float(convertByteArrayToFloat(name + " ("
-                    + entry.tagInfo.name + ")", entry.valueOffsetBytes,
+            return new Float(BinaryConversions.toFloat(
+                    entry.valueOffsetBytes,
                     entry.byteOrder));
         }
 
-        return convertByteArrayToFloatArray(name + " (" + entry.tagInfo.name
-                + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
+        return BinaryConversions.toFloats(getRawBytes(entry), 0, 4*entry.length,
+                entry.byteOrder);
     }
 
     @Override
-    public byte[] writeData(Object o, int byteOrder) throws ImageWriteException {
+    public byte[] writeData(Object o, ByteOrder byteOrder) throws ImageWriteException {
         if (o instanceof Float) {
-            return convertFloatToByteArray(((Float) o).floatValue(), byteOrder);
+            return BinaryConversions.toBytes(((Float) o).floatValue(), byteOrder);
         } else if (o instanceof float[]) {
             float numbers[] = (float[]) o;
-            return convertFloatArrayToByteArray(numbers, byteOrder);
+            return BinaryConversions.toBytes(numbers, byteOrder);
         } else if (o instanceof Float[]) {
             Float numbers[] = (Float[]) o;
             float values[] = new float[numbers.length];
             for (int i = 0; i < values.length; i++) {
                 values[i] = numbers[i].floatValue();
             }
-            return convertFloatArrayToByteArray(values, byteOrder);
+            return BinaryConversions.toBytes(values, byteOrder);
         } else {
             throw new ImageWriteException("Invalid data: " + o + " ("
                     + Debug.getType(o) + ")");

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -17,6 +17,8 @@
 package org.apache.commons.imaging.formats.tiff.fieldtypes;
 
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.common.BinaryConversions;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.TiffField;
 import org.apache.commons.imaging.util.Debug;
 
@@ -28,30 +30,28 @@ public class FieldTypeLong extends Field
     @Override
     public Object getSimpleValue(TiffField entry) {
         if (entry.length == 1) {
-            return convertByteArrayToInt(
-                    name + " (" + entry.tagInfo.name + ")",
+            return BinaryConversions.toInt(
                     entry.valueOffsetBytes, entry.byteOrder);
         }
 
-        return convertByteArrayToIntArray(name + " (" + entry.tagInfo.name
-                + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
+        return BinaryConversions.toInts(getRawBytes(entry), 0, 4*entry.length,
+                entry.byteOrder);
     }
 
     @Override
-    public byte[] writeData(Object o, int byteOrder) throws ImageWriteException {
+    public byte[] writeData(Object o, ByteOrder byteOrder) throws ImageWriteException {
         if (o instanceof Integer) {
-            return convertIntArrayToByteArray(
-                    new int[] { ((Integer) o).intValue(), }, byteOrder);
+            return BinaryConversions.toBytes(((Integer)o).intValue(), byteOrder);
         } else if (o instanceof int[]) {
             int numbers[] = (int[]) o;
-            return convertIntArrayToByteArray(numbers, byteOrder);
+            return BinaryConversions.toBytes(numbers, byteOrder);
         } else if (o instanceof Integer[]) {
             Integer numbers[] = (Integer[]) o;
             int values[] = new int[numbers.length];
             for (int i = 0; i < values.length; i++) {
                 values[i] = numbers[i].intValue();
             }
-            return convertIntArrayToByteArray(values, byteOrder);
+            return BinaryConversions.toBytes(values, byteOrder);
         } else {
             throw new ImageWriteException("Invalid data: " + o + " ("
                     + Debug.getType(o) + ")");

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -17,6 +17,8 @@
 package org.apache.commons.imaging.formats.tiff.fieldtypes;
 
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.common.BinaryConversions;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.RationalNumber;
 import org.apache.commons.imaging.common.RationalNumberUtilities;
 import org.apache.commons.imaging.formats.tiff.TiffField;
@@ -30,26 +32,25 @@ public class FieldTypeRational extends F
     @Override
     public Object getSimpleValue(TiffField entry) {
         if (entry.length == 1) {
-            return convertByteArrayToRational(name + " (" + entry.tagInfo.name
-                    + ")", entry.oversizeValue, entry.byteOrder);
+            return BinaryConversions.toRational(entry.oversizeValue, entry.byteOrder);
         }
 
-        return convertByteArrayToRationalArray(name + " (" + entry.tagInfo.name
-                + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
+        return BinaryConversions.toRationals(getRawBytes(entry), 0, 8*entry.length,
+                entry.byteOrder);
     }
 
     @Override
-    public byte[] writeData(Object o, int byteOrder) throws ImageWriteException {
+    public byte[] writeData(Object o, ByteOrder byteOrder) throws ImageWriteException {
         if (o instanceof RationalNumber) {
-            return convertRationalToByteArray((RationalNumber) o, byteOrder);
+            return BinaryConversions.toBytes((RationalNumber) o, byteOrder);
         } else if (o instanceof RationalNumber[]) {
-            return convertRationalArrayToByteArray((RationalNumber[]) o,
+            return BinaryConversions.toBytes((RationalNumber[]) o,
                     byteOrder);
         } else if (o instanceof Number) {
             Number number = (Number) o;
             RationalNumber rationalNumber = RationalNumberUtilities
                     .getRationalNumber(number.doubleValue());
-            return convertRationalToByteArray(rationalNumber, byteOrder);
+            return BinaryConversions.toBytes(rationalNumber, byteOrder);
         } else if (o instanceof Number[]) {
             Number numbers[] = (Number[]) o;
             RationalNumber rationalNumbers[] = new RationalNumber[numbers.length];
@@ -58,7 +59,7 @@ public class FieldTypeRational extends F
                 rationalNumbers[i] = RationalNumberUtilities
                         .getRationalNumber(number.doubleValue());
             }
-            return convertRationalArrayToByteArray(rationalNumbers, byteOrder);
+            return BinaryConversions.toBytes(rationalNumbers, byteOrder);
         } else if (o instanceof double[]) {
             double numbers[] = (double[]) o;
             RationalNumber rationalNumbers[] = new RationalNumber[numbers.length];
@@ -67,20 +68,20 @@ public class FieldTypeRational extends F
                 rationalNumbers[i] = RationalNumberUtilities
                         .getRationalNumber(number);
             }
-            return convertRationalArrayToByteArray(rationalNumbers, byteOrder);
+            return BinaryConversions.toBytes(rationalNumbers, byteOrder);
         } else {
             throw new ImageWriteException("Invalid data: " + o + " ("
                     + Debug.getType(o) + ")");
         }
     }
 
-    public byte[] writeData(int numerator, int denominator, int byteOrder)
+    public byte[] writeData(int numerator, int denominator, ByteOrder byteOrder)
             throws ImageWriteException {
         return writeData(new int[] { numerator }, new int[] { denominator },
                 byteOrder);
     }
 
-    public byte[] writeData(int numerators[], int denominators[], int byteOrder)
+    public byte[] writeData(int numerators[], int denominators[], ByteOrder byteOrder)
             throws ImageWriteException {
         return convertIntArrayToRationalArray(numerators, denominators,
                 byteOrder);

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -19,6 +19,7 @@ package org.apache.commons.imaging.forma
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.common.BinaryConversions;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.TiffField;
 import org.apache.commons.imaging.util.Debug;
 
@@ -27,46 +28,32 @@ public class FieldTypeShort extends Fiel
         super(type, 2, name);
     }
 
-    // public Object[] getValueArray(TiffField entry)
-    // {
-    // if(isLocalValue(entry))
-    // return convertByteArrayToShortArray(name + " (" + entry.tagInfo.name
-    // + ")", entry.valueOffsetBytes, 0, entry.length, entry.byteOrder);
-    //
-    // // return new Integer(convertByteArrayToShort(name + " ("
-    // // + entry.tagInfo.name + ")", entry.valueOffsetBytes,
-    // // entry.byteOrder));
-    //
-    // return convertByteArrayToShortArray(name + " (" + entry.tagInfo.name
-    // + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
-    // }
-
     @Override
     public Object getSimpleValue(TiffField entry) throws ImageReadException {
         if (entry.length == 1) {
-            return BinaryConversions.convertToShort(entry.valueOffsetBytes,
+            return BinaryConversions.toShort(entry.valueOffsetBytes,
                     entry.byteOrder);
         }
 
-        return BinaryConversions.convertToShortArray(getRawBytes(entry),
+        return BinaryConversions.toShorts(getRawBytes(entry),
                 entry.byteOrder);
     }
 
     @Override
-    public byte[] writeData(Object o, int byteOrder) throws ImageWriteException {
+    public byte[] writeData(Object o, ByteOrder byteOrder) throws ImageWriteException {
         if (o instanceof Short) {
-            return BinaryConversions.convertToByteArray(
-                    new short[] { ((Short) o).shortValue(), }, byteOrder);
+            return BinaryConversions.toBytes(
+                    ((Short)o).shortValue(), byteOrder);
         } else if (o instanceof short[]) {
             short numbers[] = (short[]) o;
-            return BinaryConversions.convertToByteArray(numbers, byteOrder);
+            return BinaryConversions.toBytes(numbers, byteOrder);
         } else if (o instanceof Short[]) {
             Short numbers[] = (Short[]) o;
             short values[] = new short[numbers.length];
             for (int i = 0; i < values.length; i++) {
                 values[i] = numbers[i].shortValue();
             }
-            return BinaryConversions.convertToByteArray(values, byteOrder);
+            return BinaryConversions.toBytes(values, byteOrder);
         } else {
             throw new ImageWriteException("Invalid data: " + o + " ("
                     + Debug.getType(o) + ")");

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeUnknown.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeUnknown.java?rev=1391794&r1=1391793&r2=1391794&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeUnknown.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeUnknown.java Sat Sep 29 13:01:01 2012
@@ -17,6 +17,7 @@
 package org.apache.commons.imaging.formats.tiff.fieldtypes;
 
 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.util.Debug;
 
@@ -45,7 +46,7 @@ public class FieldTypeUnknown extends Fi
     }
 
     @Override
-    public byte[] writeData(Object o, int byteOrder) throws ImageWriteException {
+    public byte[] writeData(Object o, ByteOrder byteOrder) throws ImageWriteException {
         if (o instanceof Byte) {
             return new byte[] { ((Byte) o).byteValue(), };
         } else if (o instanceof byte[]) {

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -24,6 +24,7 @@ import java.util.List;
 
 import org.apache.commons.imaging.ImageReadException;
 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;
@@ -83,7 +84,7 @@ public abstract class TagInfo implements
         return o;
     }
 
-    public byte[] encodeValue(FieldType fieldType, Object value, int byteOrder)
+    public byte[] encodeValue(FieldType fieldType, Object value, ByteOrder byteOrder)
             throws ImageWriteException {
         return fieldType.writeData(value, byteOrder);
     }

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -19,6 +19,7 @@ package org.apache.commons.imaging.forma
 import java.io.UnsupportedEncodingException;
 
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 public class TagInfoAscii extends TagInfo {
@@ -27,7 +28,7 @@ public class TagInfoAscii extends TagInf
         super(name, tag, FIELD_TYPE_ASCII, length, directoryType);
     }
 
-    public String[] getValue(int byteOrder, byte[] bytes) {
+    public String[] getValue(ByteOrder byteOrder, byte[] bytes) {
         int nullCount = 1;
         for (int i = 0; i < bytes.length - 1; i++) {
             if (bytes[i] == 0) {
@@ -64,7 +65,7 @@ public class TagInfoAscii extends TagInf
         return strings;
     }
 
-    public byte[] encodeValue(int byteOrder, String... values)
+    public byte[] encodeValue(ByteOrder byteOrder, String... values)
             throws ImageWriteException {
         return FIELD_TYPE_ASCII.writeData(values, byteOrder);
     }

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -18,6 +18,7 @@ package org.apache.commons.imaging.forma
 
 import java.util.List;
 
+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;
 
@@ -31,7 +32,7 @@ public class TagInfoByte extends TagInfo
         super(name, tag, fieldTypes, length, directoryType);
     }
 
-    public byte[] encodeValue(int byteOrder, byte... values) {
+    public byte[] encodeValue(ByteOrder byteOrder, 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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -17,6 +17,7 @@
 package org.apache.commons.imaging.formats.tiff.taginfos;
 
 import org.apache.commons.imaging.common.BinaryConversions;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 public class TagInfoByteOrShort extends TagInfo {
@@ -24,11 +25,11 @@ public class TagInfoByteOrShort extends 
         super(name, tag, FIELD_TYPE_DESCRIPTION_BYTE_OR_SHORT, length, directoryType);
     }
     
-    public byte[] encodeValue(int byteOrder, byte... values) {
+    public byte[] encodeValue(ByteOrder byteOrder, byte... values) {
         return values;
     }
     
-    public byte[] encodeValue(int byteOrder, short... values) {
-        return BinaryConversions.convertToByteArray(values, byteOrder);
+    public byte[] encodeValue(ByteOrder byteOrder, short... values) {
+        return BinaryConversions.toBytes(values, byteOrder);
     }
 }

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -18,6 +18,7 @@ package org.apache.commons.imaging.forma
 
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.common.BinaryConversions;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 public class TagInfoDouble extends TagInfo {
@@ -25,11 +26,11 @@ public class TagInfoDouble extends TagIn
         super(name, tag, FIELD_TYPE_DOUBLE, length, directoryType);
     }
     
-    public double[] getValue(int byteOrder, byte[] bytes) {
-        return BinaryConversions.convertToDoubleArray(bytes, byteOrder);
+    public double[] getValue(ByteOrder byteOrder, byte[] bytes) {
+        return BinaryConversions.toDoubles(bytes, byteOrder);
     }
     
-    public byte[] encodeValue(int byteOrder, double... values) throws ImageWriteException {
-        return BinaryConversions.convertToByteArray(values, byteOrder);
+    public byte[] encodeValue(ByteOrder byteOrder, double... values) throws ImageWriteException {
+        return BinaryConversions.toBytes(values, byteOrder);
     }
 }

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -18,6 +18,7 @@ package org.apache.commons.imaging.forma
 
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.common.BinaryConversions;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 public class TagInfoFloat extends TagInfo {
@@ -25,11 +26,11 @@ public class TagInfoFloat extends TagInf
         super(name, tag, FIELD_TYPE_FLOAT, length, directoryType);
     }
     
-    public float[] getValue(int byteOrder, byte[] bytes) {
-        return BinaryConversions.convertToFloatArray(bytes, byteOrder);
+    public float[] getValue(ByteOrder byteOrder, byte[] bytes) {
+        return BinaryConversions.toFloats(bytes, byteOrder);
     }
     
-    public byte[] encodeValue(int byteOrder, float... values) throws ImageWriteException {
-        return BinaryConversions.convertToByteArray(values, byteOrder);
+    public byte[] encodeValue(ByteOrder byteOrder, float... values) throws ImageWriteException {
+        return BinaryConversions.toBytes(values, byteOrder);
     }
 }

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -20,8 +20,8 @@ import java.io.UnsupportedEncodingExcept
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
-import org.apache.commons.imaging.common.BinaryConstants;
 import org.apache.commons.imaging.common.BinaryFileFunctions;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.TiffField;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
@@ -50,8 +50,8 @@ public final class TagInfoGpsText extend
             this.encodingNameBE = encodingNameBE;
         }
 
-        public String getEncodingName(int byteOrder) {
-            if (byteOrder == BinaryConstants.BYTE_ORDER_BIG_ENDIAN) {
+        public String getEncodingName(ByteOrder byteOrder) {
+            if (byteOrder == ByteOrder.BIG_ENDIAN) {
                 return encodingNameBE;
             } else {
                 return encodingNameLE;
@@ -81,7 +81,7 @@ public final class TagInfoGpsText extend
     };
 
     @Override
-    public byte[] encodeValue(FieldType fieldType, Object value, int byteOrder)
+    public byte[] encodeValue(FieldType fieldType, Object value, ByteOrder byteOrder)
             throws ImageWriteException {
         if (!(value instanceof String)) {
             throw new ImageWriteException("GPS text value not String: " + value

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -17,6 +17,7 @@
 package org.apache.commons.imaging.formats.tiff.taginfos;
 
 import org.apache.commons.imaging.common.BinaryConversions;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
 
@@ -29,11 +30,11 @@ public class TagInfoLong extends TagInfo
         super(name, tag, FIELD_TYPE_LONG, length, directoryType, isOffset);
     }
     
-    public int[] getValue(int byteOrder, byte[] bytes) {
-        return BinaryConversions.convertToIntArray(bytes, byteOrder);
+    public int[] getValue(ByteOrder byteOrder, byte[] bytes) {
+        return BinaryConversions.toInts(bytes, byteOrder);
     }
     
-    public byte[] encodeValue(int byteOrder, int... values) {
-        return BinaryConversions.convertToByteArray(values, byteOrder);
+    public byte[] encodeValue(ByteOrder byteOrder, int... values) {
+        return BinaryConversions.toBytes(values, byteOrder);
     }
 }

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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012
@@ -17,6 +17,7 @@
 package org.apache.commons.imaging.formats.tiff.taginfos;
 
 import org.apache.commons.imaging.common.BinaryConversions;
+import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.common.RationalNumber;
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 
@@ -25,11 +26,11 @@ public class TagInfoRational extends Tag
         super(name, tag, FIELD_TYPE_RATIONAL, length, directoryType);
     }
 
-    public RationalNumber[] getValue(int byteOrder, byte[] bytes) {
-        return BinaryConversions.convertToRationalArray(bytes, byteOrder);
+    public RationalNumber[] getValue(ByteOrder byteOrder, byte[] bytes) {
+        return BinaryConversions.toRationals(bytes, byteOrder);
     }
     
-    public byte[] encodeValue(int byteOrder, RationalNumber... values) {
-        return BinaryConversions.convertToByteArray(values, byteOrder);
+    public byte[] encodeValue(ByteOrder byteOrder, RationalNumber... values) {
+        return BinaryConversions.toBytes(values, byteOrder);
     }
 }



Mime
View raw message