Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

ByteSequence.java

00001 package de.fub.bytecode.util;
00002 
00003 import java.io.*;
00004 
00005 /**
00006  * Utility class that implements a sequence of bytes which can be read
00007  * via the `readByte()' method. This is used to implement a wrapper for the 
00008  * Java byte code stream to gain some more readability.
00009  *
00010  * @version $Id: ByteSequence.java,v 1.1.1.1 2002/01/24 03:44:02 pserver Exp $
00011  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00012  */
00013 public final class ByteSequence extends DataInputStream {
00014   private ByteArrayStream byte_stream;
00015 
00016   private static final class ByteArrayStream extends ByteArrayInputStream {
00017     ByteArrayStream(byte[] bytes) { super(bytes); }
00018     final int  getPosition() { return pos; } // is protected in ByteArrayInputStream
00019     final void unreadByte()  { if(pos > 0) pos--; }
00020   }
00021   public ByteSequence(byte[] bytes) { 
00022     super(new ByteArrayStream(bytes));
00023     byte_stream = (ByteArrayStream)in;
00024   }  
00025   public final int getIndex()   { return byte_stream.getPosition(); }  
00026   final  void      unreadByte() { byte_stream.unreadByte(); }  
00027 }

Generated at Thu Feb 7 06:41:42 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001