diff --git a/dexlib/src/main/java/org/jf/dexlib/Util/ByteArray.java b/dexlib/src/main/java/org/jf/dexlib/Util/ByteArray.java index 84192d88..ff5fb947 100644 --- a/dexlib/src/main/java/org/jf/dexlib/Util/ByteArray.java +++ b/dexlib/src/main/java/org/jf/dexlib/Util/ByteArray.java @@ -246,134 +246,4 @@ public final class ByteArray { private int getUnsignedByte0(int off) { return bytes[start + off] & 0xff; } - - /** - * Gets a DataInputStream that reads from this instance, - * with the cursor starting at the beginning of this instance's data. - * Note: The returned instance may be cast to {@link #GetCursor} - * if needed. - * - * @return non-null; an appropriately-constructed - * DataInputStream instance - */ - public MyDataInputStream makeDataInputStream() { - return new MyDataInputStream(makeInputStream()); - } - - /** - * Gets a InputStream that reads from this instance, - * with the cursor starting at the beginning of this instance's data. - * Note: The returned instance may be cast to {@link #GetCursor} - * if needed. - * - * @return non-null; an appropriately-constructed - * InputStream instancex - */ - public MyInputStream makeInputStream() { - return new MyInputStream(); - } - - /** - * Helper interface that allows one to get the cursor (of a stream). - */ - public interface GetCursor { - /** - * Gets the current cursor. - * - * @return 0..size(); the cursor - */ - public int getCursor(); - } - - /** - * Helper class for {@link #makeInputStream}, which implements the - * stream functionality. - */ - public class MyInputStream extends InputStream { - /** 0..size; the cursor */ - private int cursor; - - /** 0..size; the mark */ - private int mark; - - public MyInputStream() { - cursor = 0; - mark = 0; - } - - public int read() throws IOException { - if (cursor >= size) { - return -1; - } - - int result = getUnsignedByte0(cursor); - cursor++; - return result; - } - - public int read(byte[] arr, int offset, int length) { - if ((offset + length) > arr.length) { - length = arr.length - offset; - } - - int maxLength = size - cursor; - if (length > maxLength) { - length = maxLength; - } - - System.arraycopy(bytes, cursor, arr, offset, length); - cursor += length; - return length; - } - - public int available() { - return size - cursor; - } - - public void mark(int reserve) { - mark = cursor; - } - - public void reset() { - cursor = mark; - } - - public boolean markSupported() { - return true; - } - - /** - * Gets the current cursor. - * - * @return 0..size(); the cursor - */ - public int getCursor() { - return cursor; - } - } - - /** - * Helper class for {@link #makeDataInputStream}. This is used - * simply so that the cursor of a wrapped {@link #MyInputStream} - * instance may be easily determined. - */ - public class MyDataInputStream extends DataInputStream { - /** non-null; the underlying {@link #MyInputStream} */ - private final MyInputStream wrapped; - - public MyDataInputStream(MyInputStream wrapped) { - super(wrapped); - - this.wrapped = wrapped; - } - - /** - * Gets the current cursor. - * - * @return 0..size(); the cursor - */ - public int getCursor() { - return wrapped.getCursor(); - } - } }