commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r1545595 - in /commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging: common/BinaryInputStream.java formats/jpeg/iptc/IptcParser.java
Date Tue, 26 Nov 2013 10:15:07 GMT
Author: ebourg
Date: Tue Nov 26 10:15:07 2013
New Revision: 1545595

URL: http://svn.apache.org/r1545595
Log:
Removed the unused methods in BinaryInputStream

Modified:
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryInputStream.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryInputStream.java?rev=1545595&r1=1545594&r2=1545595&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryInputStream.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryInputStream.java
Tue Nov 26 10:15:07 2013
@@ -16,49 +16,21 @@
  */
 package org.apache.commons.imaging.common;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.RandomAccessFile;
 
 import org.apache.commons.imaging.ImageReadException;
 
 public class BinaryInputStream extends InputStream {
-    private final InputStream is;
-    // default byte order for Java, many file formats.
-    private ByteOrder byteOrder = ByteOrder.NETWORK;
-    private boolean debug = false;
-
-    public final void setDebug(final boolean b) {
-        debug = b;
-    }
-
-    public final boolean getDebug() {
-        return debug;
-    }
 
-    public BinaryInputStream(final byte bytes[], final ByteOrder byteOrder) {
-        this.byteOrder = byteOrder;
-        this.is = new ByteArrayInputStream(bytes);
-    }
+    private final InputStream is;
+    private final ByteOrder byteOrder;
 
     public BinaryInputStream(final InputStream is, final ByteOrder byteOrder) {
         this.byteOrder = byteOrder;
         this.is = is;
     }
 
-    public BinaryInputStream(final InputStream is) {
-        this.is = is;
-    }
-
-    public final void setByteOrder(final ByteOrder byteOrder) {
-        this.byteOrder = byteOrder;
-    }
-
-    public final ByteOrder getByteOrder() {
-        return byteOrder;
-    }
-
     @Override
     public int read() throws IOException {
         return is.read();
@@ -69,98 +41,34 @@ public class BinaryInputStream extends I
         return BinaryFunctions.read4Bytes(name, is, exception, byteOrder);
     }
 
-    public final void debugNumber(final String msg, final int data) {
-        debugNumber(msg, data, 1);
-    }
-
-    public final void debugNumber(final String msg, final int data, final int bytes) {
-        System.out.print(msg + ": " + data + " (");
-        int byteData = data;
-        for (int i = 0; i < bytes; i++) {
-            if (i > 0) {
-                System.out.print(",");
-            }
-            final int singleByte = 0xff & byteData;
-            System.out.print((char) singleByte + " [" + singleByte + "]");
-            byteData >>= 8;
-        }
-        System.out.println(") [0x" + Integer.toHexString(data) + ", "
-                + Integer.toBinaryString(data) + "]");
-    }
-
     public final void readAndVerifyBytes(final byte expected[], final String exception)
             throws ImageReadException, IOException {
         BinaryFunctions.readAndVerifyBytes(is, expected, exception);
     }
 
-    public final void readAndVerifyBytes(final String name, final byte expected[],
-            final String exception) throws ImageReadException, IOException {
-        BinaryFunctions.readAndVerifyBytes(name, is, expected, exception);
-    }
-
     public final void skipBytes(final long length, final String exception)
             throws IOException {
         BinaryFunctions.skipBytes(is, length, exception);
     }
 
-    public final void scanForByte(final byte value) throws IOException {
-        BinaryFunctions.scanForByte(is, value);
-    }
-
     public final byte[] readBytes(final String name, final int length, final String exception)
             throws IOException {
         return BinaryFunctions.readBytes(name, is, length, exception);
     }
 
-    public final void debugByteArray(final String name, final byte bytes[]) {
-        System.out.println(name + ": " + bytes.length);
-
-        for (int i = 0; ((i < bytes.length) && (i < 50)); i++) {
-            debugNumber(name + " (" + i + ")", bytes[i]);
-        }
-    }
-
-    public final void debugNumberArray(final String name, final int numbers[], final int
length) {
-        System.out.println(name + ": " + numbers.length);
-
-        for (int i = 0; ((i < numbers.length) && (i < 50)); i++) {
-            debugNumber(name + " (" + i + ")", numbers[i], length);
-        }
-    }
-
     public final byte[] readBytes(final int length, final String error)
             throws IOException {
         return BinaryFunctions.readBytes("", is, length, error);
     }
-
-    public final boolean compareBytes(final byte a[], final int aStart, final byte b[],
-            final int bStart, final int length) {
-        return BinaryFunctions.compareBytes(a, aStart, b, bStart, length);
-    }
-
-    public final int read4Bytes(final String name, final String exception, final ByteOrder
byteOrder)
-            throws IOException {
-        return BinaryFunctions.read4Bytes(name, is, exception, byteOrder);
-    }
     
     public final int read4Bytes(final String exception) throws IOException {
         return BinaryFunctions.read4Bytes("", is, exception, byteOrder);
     }
-
-    public final int read3Bytes(final String name, final String exception, final ByteOrder
byteOrder)
-            throws IOException {
-        return BinaryFunctions.read3Bytes(name, is, exception, byteOrder);
-    }
     
     public final int read3Bytes(final String name, final String exception) throws IOException
{
         return BinaryFunctions.read3Bytes(name, is, exception, byteOrder);
     }
 
-    public final int read2Bytes(final String name, final String exception, final ByteOrder
byteOrder)
-            throws IOException {
-        return BinaryFunctions.read2Bytes(name, is, exception, byteOrder);
-    }
-
     public final int read2Bytes(final String name, final String exception)
             throws IOException {
         return BinaryFunctions.read2Bytes(name, is, exception, byteOrder);
@@ -173,34 +81,4 @@ public class BinaryInputStream extends I
     public final byte readByte(final String name, final String exception) throws IOException
{
         return BinaryFunctions.readByte(name, is, exception);
     }
-
-    public final void printCharQuad(final String msg, final int i) {
-        BinaryFunctions.printCharQuad(msg, i);
-    }
-
-    public final void printByteBits(final String msg, final byte i) {
-        BinaryFunctions.printByteBits(msg, i);
-    }
-
-    public static int charsToQuad(final char c1, final char c2, final char c3, final char
c4) {
-        return BinaryFunctions.charsToQuad(c1, c2, c3, c4);
-    }
-
-    public final int findNull(final byte src[]) {
-        return BinaryFunctions.findNull(src);
-    }
-
-    public final int findNull(final byte src[], final int start) {
-        return BinaryFunctions.findNull(src, start);
-    }
-
-    public final byte[] getRAFBytes(final RandomAccessFile raf, final long pos,
-            final int length, final String exception) throws IOException {
-        return BinaryFunctions.getRAFBytes(raf, pos, length, exception);
-    }
-
-    public void skipBytes(final long length) throws IOException {
-        BinaryFunctions.skipBytes(is, length);
-    }
-
 }

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=1545595&r1=1545594&r2=1545595&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
Tue Nov 26 10:15:07 2013
@@ -17,6 +17,7 @@
 
 package org.apache.commons.imaging.formats.jpeg.iptc;
 
+import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -262,7 +263,7 @@ public class IptcParser extends BinaryFi
         BinaryInputStream bis = null;
         boolean canThrow = false;
         try {
-            bis = new BinaryInputStream(bytes, APP13_BYTE_ORDER);
+            bis = new BinaryInputStream(new ByteArrayInputStream(bytes), APP13_BYTE_ORDER);
 
             // Note that these are unsigned quantities. Name is always an even
             // number of bytes (including the 1st byte, which is the size.)



Mime
View raw message