Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 79AFCD696 for ; Sat, 29 Sep 2012 13:02:01 +0000 (UTC) Received: (qmail 37539 invoked by uid 500); 29 Sep 2012 13:02:01 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 37474 invoked by uid 500); 29 Sep 2012 13:02:00 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 37467 invoked by uid 99); 29 Sep 2012 13:02:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Sep 2012 13:02:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Sep 2012 13:01:54 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 19DDD2388A3F for ; Sat, 29 Sep 2012 13:01:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1391794 [3/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 -0000 To: commits@commons.apache.org From: damjan@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120929130109.19DDD2388A3F@eris.apache.org> 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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012 @@ -16,6 +16,7 @@ */ package org.apache.commons.imaging.formats.tiff.taginfos; +import org.apache.commons.imaging.common.ByteOrder; import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType; public class TagInfoSByte extends TagInfo { @@ -23,7 +24,7 @@ public class TagInfoSByte extends TagInf super(name, tag, FIELD_TYPE_SBYTE, 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/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=1391794&r1=1391793&r2=1391794&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 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 TagInfoSLong extends TagInfo { @@ -25,11 +26,11 @@ public class TagInfoSLong extends TagInf super(name, tag, FIELD_TYPE_SLONG, length, directoryType); } - 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) throws ImageWriteException { - return BinaryConversions.convertToByteArray(values, byteOrder); + public byte[] encodeValue(ByteOrder byteOrder, int... values) throws ImageWriteException { + return BinaryConversions.toBytes(values, byteOrder); } } 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=1391794&r1=1391793&r2=1391794&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 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 TagInfoSRational extends Ta super(name, tag, FIELD_TYPE_SRATIONAL, 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); } } 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=1391794&r1=1391793&r2=1391794&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 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 TagInfoSShort extends TagInfo { @@ -25,11 +26,11 @@ public class TagInfoSShort extends TagIn super(name, tag, FIELD_TYPE_SSHORT, length, directoryType); } - public short[] getValue(int byteOrder, byte[] bytes) { - return BinaryConversions.convertToShortArray(bytes, byteOrder); + public short[] getValue(ByteOrder byteOrder, byte[] bytes) { + return BinaryConversions.toShorts(bytes, byteOrder); } - public byte[] encodeValue(int byteOrder, short... values) throws ImageWriteException { - return BinaryConversions.convertToByteArray(values, byteOrder); + public byte[] encodeValue(ByteOrder byteOrder, short... values) throws ImageWriteException { + return BinaryConversions.toBytes(values, byteOrder); } } Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java?rev=1391794&r1=1391793&r2=1391794&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 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 TagInfoShort extends TagInfo { @@ -24,11 +25,11 @@ public class TagInfoShort extends TagInf super(name, tag, FIELD_TYPE_SHORT, length, directoryType); } - public short[] getValue(int byteOrder, byte[] bytes) { - return BinaryConversions.convertToShortArray(bytes, byteOrder); + public short[] getValue(ByteOrder byteOrder, byte[] bytes) { + return BinaryConversions.toShorts(bytes, byteOrder); } - 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/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=1391794&r1=1391793&r2=1391794&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 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 TagInfoShortOrLong extends TagInfo { @@ -28,11 +29,11 @@ public class TagInfoShortOrLong extends super(name, tag, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, length, directoryType, isOffset); } - public byte[] encodeValue(int byteOrder, short... values) { - return BinaryConversions.convertToByteArray(values, byteOrder); + public byte[] encodeValue(ByteOrder byteOrder, short... values) { + return BinaryConversions.toBytes(values, 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/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=1391794&r1=1391793&r2=1391794&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 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,15 +26,15 @@ public class TagInfoShortOrLongOrRationa super(name, tag, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, length, directoryType); } - public byte[] encodeValue(int byteOrder, short... values) { - return BinaryConversions.convertToByteArray(values, byteOrder); + public byte[] encodeValue(ByteOrder byteOrder, short... values) { + return BinaryConversions.toBytes(values, 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); } - public byte[] encodeValue(int byteOrder, RationalNumber... values) { - return BinaryConversions.convertToByteArray(values, byteOrder); + public byte[] encodeValue(ByteOrder byteOrder, RationalNumber... values) { + return BinaryConversions.toBytes(values, byteOrder); } } Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrRational.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShortOrRational.java?rev=1391794&r1=1391793&r2=1391794&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 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 TagInfoShortOrRational exte super(name, tag, FIELD_TYPE_DESCRIPTION_SHORT_OR_RATIONAL, length, directoryType, false); } - public byte[] encodeValue(int byteOrder, short... values) { - return BinaryConversions.convertToByteArray(values, byteOrder); + public byte[] encodeValue(ByteOrder byteOrder, short... values) { + return BinaryConversions.toBytes(values, 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); } } 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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012 @@ -21,6 +21,7 @@ import java.util.Arrays; 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.TiffDirectoryType; import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType; @@ -38,7 +39,7 @@ public class TagInfoXpString extends Tag } @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("Text value not String: " + value 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=1391794&r1=1391793&r2=1391794&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 Sat Sep 29 13:01:01 2012 @@ -28,8 +28,8 @@ import java.util.Map; import org.apache.commons.imaging.ImageWriteException; import org.apache.commons.imaging.PixelDensity; -import org.apache.commons.imaging.common.BinaryConstants; import org.apache.commons.imaging.common.BinaryOutputStream; +import org.apache.commons.imaging.common.ByteOrder; import org.apache.commons.imaging.common.PackBits; import org.apache.commons.imaging.common.RationalNumberUtilities; import org.apache.commons.imaging.common.itu_t4.T4AndT6Compression; @@ -40,16 +40,15 @@ import org.apache.commons.imaging.format import org.apache.commons.imaging.formats.tiff.constants.TiffConstants; import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants; -public abstract class TiffImageWriterBase implements TiffConstants, - BinaryConstants { +public abstract class TiffImageWriterBase implements TiffConstants { - protected final int byteOrder; + protected final ByteOrder byteOrder; public TiffImageWriterBase() { this.byteOrder = DEFAULT_TIFF_BYTE_ORDER; } - public TiffImageWriterBase(int byteOrder) { + public TiffImageWriterBase(ByteOrder byteOrder) { this.byteOrder = byteOrder; } @@ -378,7 +377,7 @@ public abstract class TiffImageWriterBas int LZW_MINIMUM_CODE_SIZE = 8; MyLzwCompressor compressor = new MyLzwCompressor( - LZW_MINIMUM_CODE_SIZE, BYTE_ORDER_MSB, true); + LZW_MINIMUM_CODE_SIZE, ByteOrder.MOTOROLA, true); byte compressed[] = compressor.compress(uncompressed); strips[i] = compressed; @@ -590,8 +589,13 @@ public abstract class TiffImageWriterBas protected void writeImageFileHeader(BinaryOutputStream bos, int offsetToFirstIFD) throws IOException { - bos.write(byteOrder); - bos.write(byteOrder); + if (byteOrder == ByteOrder.INTEL) { + bos.write('I'); + bos.write('I'); + } else { + bos.write('M'); + bos.write('M'); + } bos.write2Bytes(42); // tiffVersion Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java Sat Sep 29 13:01:01 2012 @@ -29,6 +29,7 @@ import org.apache.commons.imaging.ImageR import org.apache.commons.imaging.ImageWriteException; import org.apache.commons.imaging.common.BinaryFileFunctions; import org.apache.commons.imaging.common.BinaryOutputStream; +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.formats.tiff.JpegImageData; @@ -48,7 +49,7 @@ public class TiffImageWriterLossless ext this.exifBytes = exifBytes; } - public TiffImageWriterLossless(int byteOrder, byte exifBytes[]) { + public TiffImageWriterLossless(ByteOrder byteOrder, byte exifBytes[]) { super(byteOrder); this.exifBytes = exifBytes; } Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java Sat Sep 29 13:01:01 2012 @@ -22,13 +22,14 @@ import java.util.List; import org.apache.commons.imaging.ImageWriteException; import org.apache.commons.imaging.common.BinaryOutputStream; +import org.apache.commons.imaging.common.ByteOrder; public class TiffImageWriterLossy extends TiffImageWriterBase { public TiffImageWriterLossy() { } - public TiffImageWriterLossy(int byteOrder) { + public TiffImageWriterLossy(ByteOrder byteOrder) { super(byteOrder); } Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java Sat Sep 29 13:01:01 2012 @@ -24,6 +24,7 @@ import java.util.List; 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.RationalNumber; import org.apache.commons.imaging.formats.tiff.JpegImageData; import org.apache.commons.imaging.formats.tiff.TiffDirectory; @@ -60,7 +61,7 @@ public final class TiffOutputDirectory e TiffConstants { public final int type; private final List fields = new ArrayList(); - private final int byteOrder; + private final ByteOrder byteOrder; private TiffOutputDirectory nextDirectory = null; public static final Comparator COMPARATOR = new Comparator() { public int compare(TiffOutputDirectory o1, TiffOutputDirectory o2) { @@ -78,7 +79,7 @@ public final class TiffOutputDirectory e this.nextDirectory = nextDirectory; } - public TiffOutputDirectory(final int type, final int byteOrder) { + public TiffOutputDirectory(final int type, final ByteOrder byteOrder) { this.type = type; this.byteOrder = byteOrder; } Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java Sat Sep 29 13:01:01 2012 @@ -20,6 +20,7 @@ import java.io.IOException; 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.formats.tiff.constants.TiffConstants; import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType; import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo; @@ -59,7 +60,7 @@ public class TiffOutputField implements private int sortHint = -1; protected static final TiffOutputField createOffsetField(TagInfo tagInfo, - int byteOrder) throws ImageWriteException { + ByteOrder byteOrder) throws ImageWriteException { return new TiffOutputField(tagInfo, FIELD_TYPE_LONG, 1, FIELD_TYPE_LONG.writeData(new int[] { 0, }, byteOrder)); } Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java Sat Sep 29 13:01:01 2012 @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.common.ByteOrder; import org.apache.commons.imaging.common.RationalNumberUtilities; import org.apache.commons.imaging.formats.tiff.constants.GpsTagConstants; import org.apache.commons.imaging.formats.tiff.constants.TiffConstants; @@ -27,14 +28,14 @@ import org.apache.commons.imaging.format import org.apache.commons.imaging.util.Debug; public final class TiffOutputSet implements TiffConstants { - public final int byteOrder; + public final ByteOrder byteOrder; private final List directories = new ArrayList(); public TiffOutputSet() { this(TiffConstants.DEFAULT_TIFF_BYTE_ORDER); } - public TiffOutputSet(final int byteOrder) { + public TiffOutputSet(final ByteOrder byteOrder) { super(); this.byteOrder = byteOrder; } Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java Sat Sep 29 13:01:01 2012 @@ -21,14 +21,15 @@ import java.util.List; import java.util.Map; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.common.ByteOrder; import org.apache.commons.imaging.formats.tiff.constants.TiffConstants; class TiffOutputSummary implements TiffConstants { - public final int byteOrder; + public final ByteOrder byteOrder; public final TiffOutputDirectory rootDirectory; public final Map directoryTypeMap; - public TiffOutputSummary(final int byteOrder, + public TiffOutputSummary(final ByteOrder byteOrder, final TiffOutputDirectory rootDirectory, final Map directoryTypeMap) { this.byteOrder = byteOrder; @@ -55,7 +56,7 @@ class TiffOutputSummary implements TiffC offsetItems.add(new OffsetItem(item, itemOffsetField)); } - public void updateOffsets(int byteOrder) throws ImageWriteException { + public void updateOffsets(ByteOrder byteOrder) throws ImageWriteException { for (int i = 0; i < offsetItems.size(); i++) { OffsetItem offset = offsetItems.get(i); Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java Sat Sep 29 13:01:01 2012 @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.InputStream; 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; @@ -30,7 +31,7 @@ import org.apache.commons.imaging.util.D public class IccProfileParser extends BinaryFileParser implements IccConstants { public IccProfileParser() { - this.setByteOrder(BYTE_ORDER_NETWORK); + this.setByteOrder(ByteOrder.BIG_ENDIAN); } public IccProfileInfo getICCProfileInfo(ICC_Profile icc_profile) { Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java Sat Sep 29 13:01:01 2012 @@ -24,10 +24,10 @@ import java.nio.charset.Charset; import java.util.Arrays; import org.apache.commons.imaging.ImageReadException; -import org.apache.commons.imaging.common.BinaryConstants; import org.apache.commons.imaging.common.BinaryInputStream; +import org.apache.commons.imaging.common.ByteOrder; -public class IccTag implements BinaryConstants, IccConstants { +public class IccTag implements IccConstants { public final int signature; public final int offset, length; public final IccTagType fIccTagType; @@ -51,7 +51,7 @@ public class IccTag implements BinaryCon BinaryInputStream bis = null; try { bis = new BinaryInputStream(new ByteArrayInputStream( - bytes), BYTE_ORDER_NETWORK); + bytes), ByteOrder.NETWORK); data_type_signature = bis.read4Bytes("data type signature", "ICC: corrupt tag data"); Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagDataTypes.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagDataTypes.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagDataTypes.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagDataTypes.java Sat Sep 29 13:01:01 2012 @@ -20,8 +20,8 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import org.apache.commons.imaging.ImageReadException; -import org.apache.commons.imaging.common.BinaryConstants; import org.apache.commons.imaging.common.BinaryInputStream; +import org.apache.commons.imaging.common.ByteOrder; public enum IccTagDataTypes implements IccTagDataType { DESC_TYPE( @@ -31,7 +31,7 @@ public enum IccTagDataTypes implements I { BinaryInputStream bis = new BinaryInputStream( new ByteArrayInputStream(bytes), - BinaryConstants.BYTE_ORDER_NETWORK); + ByteOrder.NETWORK); bis.read4Bytes("type_signature", "ICC: corrupt tag data"); // bis.setDebug(true); @@ -53,7 +53,7 @@ public enum IccTagDataTypes implements I { BinaryInputStream bis = new BinaryInputStream( new ByteArrayInputStream(bytes), - BinaryConstants.BYTE_ORDER_NETWORK); + ByteOrder.NETWORK); bis.read4Bytes("type_signature", "ICC: corrupt tag data"); } @@ -66,7 +66,7 @@ public enum IccTagDataTypes implements I { BinaryInputStream bis = new BinaryInputStream( new ByteArrayInputStream(bytes), - BinaryConstants.BYTE_ORDER_NETWORK); + ByteOrder.NETWORK); bis.read4Bytes("type_signature", "ICC: corrupt tag data"); } @@ -79,7 +79,7 @@ public enum IccTagDataTypes implements I { BinaryInputStream bis = new BinaryInputStream( new ByteArrayInputStream(bytes), - BinaryConstants.BYTE_ORDER_NETWORK); + ByteOrder.NETWORK); bis.read4Bytes("type_signature", "ICC: corrupt tag data"); bis.read4Bytes("ignore", "ICC: corrupt tag data"); int thesignature = bis.read4Bytes("thesignature ", @@ -105,7 +105,7 @@ public enum IccTagDataTypes implements I { BinaryInputStream bis = new BinaryInputStream( new ByteArrayInputStream(bytes), - BinaryConstants.BYTE_ORDER_NETWORK); + ByteOrder.NETWORK); bis.read4Bytes("type_signature", "ICC: corrupt tag data"); bis.read4Bytes("ignore", "ICC: corrupt tag data"); String s = new String(bytes, 8, bytes.length - 8, "US-ASCII"); Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/UnicodeUtils.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/UnicodeUtils.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/UnicodeUtils.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/UnicodeUtils.java Sat Sep 29 13:01:01 2012 @@ -19,9 +19,7 @@ package org.apache.commons.imaging.util; import java.io.UnsupportedEncodingException; -import org.apache.commons.imaging.common.BinaryConstants; - -public abstract class UnicodeUtils implements BinaryConstants { +public abstract class UnicodeUtils { /** * This class should never be instantiated. */ Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/BinaryFileFunctionsTest.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/BinaryFileFunctionsTest.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/BinaryFileFunctionsTest.java (original) +++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/BinaryFileFunctionsTest.java Sat Sep 29 13:01:01 2012 @@ -23,30 +23,30 @@ public class BinaryFileFunctionsTest ext private static class Extender extends BinaryFileFunctions { public void testFloatToByteConversion() { byte[] bytesLE = convertFloatToByteArray(1.0f, - BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); assertEquals( convertByteArrayToFloat("bytes", bytesLE, - BYTE_ORDER_LITTLE_ENDIAN), 1.0f, 0f); + ByteOrder.LITTLE_ENDIAN), 1.0f, 0f); byte[] bytesBE = convertFloatToByteArray(1.0f, - BYTE_ORDER_BIG_ENDIAN); + ByteOrder.BIG_ENDIAN); assertEquals( convertByteArrayToFloat("bytes", bytesBE, - BYTE_ORDER_BIG_ENDIAN), 1.0f, 0f); + ByteOrder.BIG_ENDIAN), 1.0f, 0f); } public void testDoubleToByteConversion() { - byte[] bytesLE = convertDoubleToByteArray(1.0, - BYTE_ORDER_LITTLE_ENDIAN); + byte[] bytesLE = BinaryConversions.toBytes(1.0, + ByteOrder.LITTLE_ENDIAN); assertEquals( convertByteArrayToDouble("bytes", bytesLE, - BYTE_ORDER_LITTLE_ENDIAN), 1.0, 0); + ByteOrder.LITTLE_ENDIAN), 1.0, 0); - byte[] bytesBE = convertDoubleToByteArray(1.0, - BYTE_ORDER_BIG_ENDIAN); + byte[] bytesBE = BinaryConversions.toBytes(1.0, + ByteOrder.BIG_ENDIAN); assertEquals( convertByteArrayToDouble("bytes", bytesBE, - BYTE_ORDER_BIG_ENDIAN), 1.0, 0); + ByteOrder.BIG_ENDIAN), 1.0, 0); } } Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsRoundTripTest.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsRoundTripTest.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsRoundTripTest.java (original) +++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsRoundTripTest.java Sat Sep 29 13:01:01 2012 @@ -25,8 +25,7 @@ import java.io.IOException; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.Imaging; import org.apache.commons.imaging.common.BinaryOutputStream; -import org.apache.commons.imaging.formats.icns.IcnsImageParser; -import org.apache.commons.imaging.formats.icns.IcnsType; +import org.apache.commons.imaging.common.ByteOrder; import org.apache.commons.imaging.util.Debug; import org.apache.commons.imaging.util.IoUtils; @@ -56,7 +55,7 @@ public class IcnsRoundTripTest extends I final int background = 0xff000000; ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN); + ByteOrder.BIG_ENDIAN); bos.write4Bytes(IcnsImageParser.ICNS_MAGIC); bos.write4Bytes(4 + 4 + 4 + 4 + 2 * 16 * 16 / 8 + 4 + 4 + 16 * 16); bos.write4Bytes(IcnsType.ICNS_16x16_1BIT_IMAGE_AND_MASK.getType()); @@ -92,7 +91,7 @@ public class IcnsRoundTripTest extends I final int background = 0x00cccccc; ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN); + ByteOrder.BIG_ENDIAN); bos.write4Bytes(IcnsImageParser.ICNS_MAGIC); bos.write4Bytes(4 + 4 + 4 + 4 + 16 * 16 + 4 + 4 + 16 * 16); bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_IMAGE.getType()); @@ -127,7 +126,7 @@ public class IcnsRoundTripTest extends I final int background = 0x00cccccc; ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN); + ByteOrder.BIG_ENDIAN); bos.write4Bytes(IcnsImageParser.ICNS_MAGIC); bos.write4Bytes(4 + 4 + 4 + 4 + 16 * 16 + 4 + 4 + 16 * 16 + 4 + 4 + 2 * 16 * 16 / 8); @@ -182,7 +181,7 @@ public class IcnsRoundTripTest extends I final int background = 0x00cccccc; ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN); + ByteOrder.BIG_ENDIAN); bos.write4Bytes(IcnsImageParser.ICNS_MAGIC); bos.write4Bytes(4 + 4 + 4 + 4 + 16 * 16 + 4 + 4 + 16 * 16 + 4 + 4 + 2 * 16 * 16 / 8); @@ -237,7 +236,7 @@ public class IcnsRoundTripTest extends I final int background = 0xffcccccc; ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN); + ByteOrder.BIG_ENDIAN); bos.write4Bytes(IcnsImageParser.ICNS_MAGIC); bos.write4Bytes(4 + 4 + 4 + 4 + 16 * 16); bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_IMAGE.getType()); @@ -261,7 +260,7 @@ public class IcnsRoundTripTest extends I final int background = 0x000000ff; ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN); + ByteOrder.BIG_ENDIAN); bos.write4Bytes(IcnsImageParser.ICNS_MAGIC); bos.write4Bytes(4 + 4 + 4 + 4 + 4 * 16 * 16 + 4 + 4 + 2 * 16 * 16 / 8); bos.write4Bytes(IcnsType.ICNS_16x16_32BIT_IMAGE.getType()); @@ -314,7 +313,7 @@ public class IcnsRoundTripTest extends I final int background = 0xff0000ff; ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN); + ByteOrder.BIG_ENDIAN); bos.write4Bytes(IcnsImageParser.ICNS_MAGIC); bos.write4Bytes(4 + 4 + 4 + 4 + 4 * 16 * 16 + 4 + 4 + 16 * 16 / 8); bos.write4Bytes(IcnsType.ICNS_16x16_32BIT_IMAGE.getType()); @@ -364,7 +363,7 @@ public class IcnsRoundTripTest extends I final int background = 0xff0000ff; ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN); + ByteOrder.BIG_ENDIAN); bos.write4Bytes(IcnsImageParser.ICNS_MAGIC); bos.write4Bytes(4 + 4 + 4 + 4 + 4 * 16 * 16); bos.write4Bytes(IcnsType.ICNS_16x16_32BIT_IMAGE.getType()); Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoRoundtripTest.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoRoundtripTest.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoRoundtripTest.java (original) +++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoRoundtripTest.java Sat Sep 29 13:01:01 2012 @@ -28,6 +28,7 @@ import org.apache.commons.imaging.ImageR import org.apache.commons.imaging.ImageWriteException; import org.apache.commons.imaging.Imaging; 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.IoUtils; @@ -73,7 +74,7 @@ public class IcoRoundtripTest extends Ic int paletteSize) throws IOException, ImageWriteException { ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(byteArrayStream, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); // Palette bos.write3Bytes(background); bos.write(0); @@ -115,7 +116,7 @@ public class IcoRoundtripTest extends Ic int paletteSize) throws IOException, ImageWriteException { ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(byteArrayStream, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); // Palette bos.write3Bytes(background); bos.write(0); @@ -148,7 +149,7 @@ public class IcoRoundtripTest extends Ic int paletteSize) throws IOException, ImageWriteException { ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(byteArrayStream, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); // Palette bos.write3Bytes(background); bos.write(0); @@ -180,7 +181,7 @@ public class IcoRoundtripTest extends Ic int paletteSize) throws IOException, ImageWriteException { ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(byteArrayStream, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); // Palette for (int i = 0; i < paletteSize; i++) bos.write4Bytes(0); @@ -215,7 +216,7 @@ public class IcoRoundtripTest extends Ic int paletteSize) throws IOException, ImageWriteException { ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(byteArrayStream, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); // Palette for (int i = 0; i < paletteSize; i++) bos.write4Bytes(0); @@ -252,7 +253,7 @@ public class IcoRoundtripTest extends Ic int paletteSize, boolean writeMask) throws IOException { ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(byteArrayStream, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); // Palette for (int i = 0; i < paletteSize; i++) bos.write4Bytes(0); @@ -326,7 +327,7 @@ public class IcoRoundtripTest extends Ic ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); byte[] bitmap = bitmapGenerator.generateBitmap(foreground, background, (bitDepth <= 8) ? (1 << bitDepth) : 0); writeICONDIR(bos, 0, 1, 1); @@ -350,7 +351,7 @@ public class IcoRoundtripTest extends Ic ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); byte[] bitmap = bitmapGenerator.generateBitmap(foreground, background, (bitDepth <= 8) ? (1 << bitDepth) : 0); writeICONDIR(bos, 0, 1, 1); @@ -392,7 +393,7 @@ public class IcoRoundtripTest extends Ic ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); byte[] bitmap = bitmapGenerator.generateBitmap(foreground, background, 2); writeICONDIR(bos, 0, 1, 1); @@ -414,7 +415,7 @@ public class IcoRoundtripTest extends Ic ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); byte[] bitmap = bitmapGenerator.generateBitmap(foreground, background, (bitDepth <= 8) ? (1 << bitDepth) : 0); writeICONDIR(bos, 0, 1, 1); @@ -440,7 +441,7 @@ public class IcoRoundtripTest extends Ic public void testBitfieldCompression() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); byte[] bitmap = new GeneratorFor32BitBitmaps().generate32bitRGBABitmap( 0xFFFF0000, 0xFFFFFFFF, 0, true); writeICONDIR(bos, 0, 1, 1); @@ -461,7 +462,7 @@ public class IcoRoundtripTest extends Ic final int background = 0xFF102030; ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); // For 32 bit RGBA, the AND mask can be missing: byte[] bitmap = new GeneratorFor32BitBitmaps().generate32bitRGBABitmap( foreground, background, 0, false); @@ -477,7 +478,7 @@ public class IcoRoundtripTest extends Ic public void testAlphaVersusANDMask() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); byte[] bitmap = new GeneratorFor32BitBitmaps().generate32bitRGBABitmap( 0xFF000000, 0x00000000, 0, true); writeICONDIR(bos, 0, 1, 1); @@ -494,7 +495,7 @@ public class IcoRoundtripTest extends Ic public void testFullyTransparent32bitRGBA() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputStream bos = new BinaryOutputStream(baos, - BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN); + ByteOrder.LITTLE_ENDIAN); byte[] bitmap = new GeneratorFor32BitBitmaps().generate32bitRGBABitmap( 0x00000000, 0x00FFFFFF, 0, true); writeICONDIR(bos, 0, 1, 1); Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java?rev=1391794&r1=1391793&r2=1391794&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java (original) +++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java Sat Sep 29 13:01:01 2012 @@ -23,12 +23,12 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.List; -import org.apache.commons.imaging.common.BinaryConstants; +import org.apache.commons.imaging.common.ByteOrder; import org.apache.commons.imaging.common.mylzw.MyLzwCompressor; import org.apache.commons.imaging.common.mylzw.MyLzwDecompressor; import org.apache.commons.imaging.util.Debug; -public class TiffLzwTest extends TiffBaseTest implements BinaryConstants { +public class TiffLzwTest extends TiffBaseTest { public void testTrivial() throws Exception { byte bytes[] = { 0, }; @@ -100,7 +100,7 @@ public class TiffLzwTest extends TiffBas }; MyLzwCompressor compressor = new MyLzwCompressor(LZW_MINIMUM_CODE_SIZE, - BYTE_ORDER_MSB, true, compressionListener); + ByteOrder.MOTOROLA, true, compressionListener); byte compressed[] = compressor.compress(src); MyLzwDecompressor.Listener decompressionListener = new MyLzwDecompressor.Listener() { @@ -147,7 +147,7 @@ public class TiffLzwTest extends TiffBas }; InputStream is = new ByteArrayInputStream(compressed); MyLzwDecompressor decompressor = new MyLzwDecompressor( - LZW_MINIMUM_CODE_SIZE, BYTE_ORDER_NETWORK, + LZW_MINIMUM_CODE_SIZE, ByteOrder.NETWORK, decompressionListener); decompressor.setTiffLZWMode(); byte decompressed[] = decompressor.decompress(is, src.length); @@ -181,7 +181,7 @@ public class TiffLzwTest extends TiffBas }; InputStream is = new ByteArrayInputStream(src); MyLzwDecompressor decompressor = new MyLzwDecompressor( - LZW_MINIMUM_CODE_SIZE, BYTE_ORDER_NETWORK, + LZW_MINIMUM_CODE_SIZE, ByteOrder.NETWORK, decompressionListener); decompressor.setTiffLZWMode(); byte decompressed[] = decompressor.decompress(is, src.length); @@ -242,7 +242,7 @@ public class TiffLzwTest extends TiffBas }; MyLzwCompressor compressor = new MyLzwCompressor(LZW_MINIMUM_CODE_SIZE, - BYTE_ORDER_MSB, true, compressionListener); + ByteOrder.MOTOROLA, true, compressionListener); byte compressed[] = compressor.compress(decompressed); assertEquals(src.length, compressed.length);