1 cananian 1.1.2.2 // ClassDataInputStream.java, created Mon Jan 18 22:44:36 1999 by cananian 2 cananian 1.1.2.1 // Copyright (C) 1998 C. Scott Ananian <cananian@alumni.princeton.edu> 3 cananian 1.1.2.1 // Licensed under the terms of the GNU GPL; see COPYING for details. 4 cananian 1.1.2.1 package harpoon.IR.RawClass; 5 cananian 1.1.2.1 6 cananian 1.1.2.1 /** 7 cananian 1.1.2.1 * A specialized input stream reader for java bytecode files. 8 cananian 1.1.2.1 * 9 cananian 1.1.2.1 * @author C. Scott Ananian <cananian@alumni.princeton.edu> 10 cananian 1.2 * @version $Id: ClassDataInputStream.java,v 1.2 2002/02/25 21:05:26 cananian Exp $ 11 cananian 1.1.2.1 * @see ClassDataOutputStream 12 cananian 1.1.2.1 */ 13 cananian 1.1.2.1 public class ClassDataInputStream extends java.io.DataInputStream { 14 cananian 1.1.2.1 /** Creates a <code>ClassDataInputStream</code> from a standard 15 cananian 1.1.2.1 * <code>InputStream</code>. */ 16 cananian 1.1.2.1 public ClassDataInputStream(java.io.InputStream in) { 17 cananian 1.1.2.1 super(in); 18 cananian 1.1.2.1 } 19 cananian 1.1.2.1 20 cananian 1.1.2.1 /** Supplies the mysterious missing method from the standard 21 cananian 1.1.2.1 * <code>DataInputStream</code> superclass. */ 22 cananian 1.1.2.1 public final long readUnsignedInt() throws java.io.IOException { 23 cananian 1.1.2.1 return (((long) readUnsignedShort()) << 16) | ((long) readUnsignedShort()); 24 cananian 1.1.2.1 } 25 cananian 1.1.2.1 26 cananian 1.1.2.1 /** Read an unsigned one-byte quantity, high byte first. */ 27 cananian 1.1.2.1 public final int read_u1() throws java.io.IOException 28 cananian 1.1.2.1 { return readUnsignedByte(); } 29 cananian 1.1.2.1 /** Read an unsigned two-byte quantity, high byte first. */ 30 cananian 1.1.2.1 public final int read_u2() throws java.io.IOException 31 cananian 1.1.2.1 { return readUnsignedShort(); } 32 cananian 1.1.2.1 /** Read an unsigned four-byte quantity, high byte first. */ 33 cananian 1.1.2.1 public final long read_u4() throws java.io.IOException 34 cananian 1.1.2.1 { return readUnsignedInt(); } 35 cananian 1.2 }