1 17 package org.apache.bcel.util; 18 19 import java.io.ByteArrayInputStream ; 20 import java.io.DataInputStream ; 21 22 30 public final class ByteSequence extends DataInputStream { 31 32 private ByteArrayStream byte_stream; 33 34 35 public ByteSequence(byte[] bytes) { 36 super(new ByteArrayStream(bytes)); 37 byte_stream = (ByteArrayStream) in; 38 } 39 40 41 public final int getIndex() { 42 return byte_stream.getPosition(); 43 } 44 45 46 final void unreadByte() { 47 byte_stream.unreadByte(); 48 } 49 50 private static final class ByteArrayStream extends ByteArrayInputStream { 51 52 ByteArrayStream(byte[] bytes) { 53 super(bytes); 54 } 55 56 57 final int getPosition() { 58 return pos; 59 } 61 62 final void unreadByte() { 63 if (pos > 0) { 64 pos--; 65 } 66 } 67 } 68 } 69 | Popular Tags |