its.backbone.frame
Class ItsInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended byits.backbone.frame.ItsInputStream
All Implemented Interfaces:
java.io.DataInput

public abstract class ItsInputStream
extends java.io.FilterInputStream
implements java.io.DataInput

Reads ITS data objects from an underlying stream in network format. By definition, all ITS data types know how to read themselves from this stream type by implementing the abstract method ItsData.read.

Version:
$Id: ItsInputStream.java,v 1.7 1998/02/13 21:39:44 kint Exp $
Author:
Rick Kint
See Also:
ItsData.read(its.backbone.frame.ItsInputStream)

Nested Class Summary
static class ItsInputStream.ByteOrder
           
 
Field Summary
static ItsInputStream.ByteOrder BIGENDIAN
           
protected  java.io.DataInputStream dis
           
static ItsInputStream.ByteOrder INTELBYTEORDER
           
static ItsInputStream.ByteOrder LITTLEENDIAN
           
static ItsInputStream.ByteOrder NETWORKBYTEORDER
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
protected ItsInputStream(java.io.DataInputStream dis)
           
 
Method Summary
static ItsInputStream create(byte[] byteInput)
          further convenience routine, a byte array and an assumed byte ordering...
static ItsInputStream create(byte[] byteInput, ItsInputStream.ByteOrder bo)
          convenience routine for create method above, where we supply a byte array rather than an input stream
static ItsInputStream create(java.io.InputStream is)
           
static ItsInputStream create(java.io.InputStream is, ItsInputStream.ByteOrder bo)
          this is the public interface to this class.
 java.lang.String readAsciiString(int length)
          Reads a fixed-length ASCII string, which may or may not be null-terminated.
 boolean readBoolean()
          partial implementation of DataInput, just the parts which don't depend on the endianness of the data, i.e. non multi-byte numeric values
 byte readByte()
           
 char readChar()
           
 void readFully(byte[] b)
           
 void readFully(byte[] b, int off, int len)
           
abstract  int readInt(int byteCount)
           
static double readLEDouble(java.io.DataInput di)
          Reads a double from a Little Endian (Intel) byte ordered source..
static float readLEFloat(java.io.DataInput di)
          Reads a float from a Little Endian (Intel) byte ordered source..
static int readLEInt(java.io.DataInput di)
          Reads an int from a Little Endian (Intel) byte ordered source..
static int readLEInt(java.io.DataInput di, int byteCount)
          Reads N (0
static long readLELong(java.io.DataInput di)
          Reads a long from a Little Endian (Intel) byte ordered source..
static short readLEShort(java.io.DataInput di)
          Reads a short from a Little Endian (Intel) byte ordered source..
static int readLEUnsignedShort(java.io.DataInput di)
           
 java.lang.String readLine()
           
 int readUnsignedByte()
           
abstract  long readUnsignedInt()
           
abstract  long readUnsignedInt(int byteCount)
           
 java.lang.String readUTF()
           
 int skipBytes(int n)
           
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.DataInput
readDouble, readFloat, readInt, readLong, readShort, readUnsignedShort
 

Field Detail

dis

protected final java.io.DataInputStream dis

BIGENDIAN

public static final ItsInputStream.ByteOrder BIGENDIAN

NETWORKBYTEORDER

public static final ItsInputStream.ByteOrder NETWORKBYTEORDER

LITTLEENDIAN

public static final ItsInputStream.ByteOrder LITTLEENDIAN

INTELBYTEORDER

public static final ItsInputStream.ByteOrder INTELBYTEORDER
Constructor Detail

ItsInputStream

protected ItsInputStream(java.io.DataInputStream dis)
Method Detail

create

public static ItsInputStream create(java.io.InputStream is,
                                    ItsInputStream.ByteOrder bo)
this is the public interface to this class. A factory method, to which a underlying stream and byte ordering are provided. We return a concrete class which always reads multi-byte values in the correct way.


create

public static ItsInputStream create(java.io.InputStream is)

create

public static ItsInputStream create(byte[] byteInput,
                                    ItsInputStream.ByteOrder bo)
convenience routine for create method above, where we supply a byte array rather than an input stream


create

public static ItsInputStream create(byte[] byteInput)
further convenience routine, a byte array and an assumed byte ordering...


readAsciiString

public java.lang.String readAsciiString(int length)
                                 throws java.io.IOException
Reads a fixed-length ASCII string, which may or may not be null-terminated. Trailing nulls are removed.

Throws:
java.io.IOException

readBoolean

public boolean readBoolean()
                    throws java.io.IOException
partial implementation of DataInput, just the parts which don't depend on the endianness of the data, i.e. non multi-byte numeric values

Specified by:
readBoolean in interface java.io.DataInput
Throws:
java.io.IOException

readByte

public byte readByte()
              throws java.io.IOException
Specified by:
readByte in interface java.io.DataInput
Throws:
java.io.IOException

readChar

public char readChar()
              throws java.io.IOException
Specified by:
readChar in interface java.io.DataInput
Throws:
java.io.IOException

readLine

public java.lang.String readLine()
                          throws java.io.IOException
Specified by:
readLine in interface java.io.DataInput
Throws:
java.io.IOException

readUnsignedByte

public int readUnsignedByte()
                     throws java.io.IOException
Specified by:
readUnsignedByte in interface java.io.DataInput
Throws:
java.io.IOException

readUTF

public java.lang.String readUTF()
                         throws java.io.IOException
Specified by:
readUTF in interface java.io.DataInput
Throws:
java.io.IOException

readFully

public void readFully(byte[] b)
               throws java.io.IOException
Specified by:
readFully in interface java.io.DataInput
Throws:
java.io.IOException

readFully

public void readFully(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException
Specified by:
readFully in interface java.io.DataInput
Throws:
java.io.IOException

skipBytes

public int skipBytes(int n)
              throws java.io.IOException
Specified by:
skipBytes in interface java.io.DataInput
Throws:
java.io.IOException

readInt

public abstract int readInt(int byteCount)
                     throws java.io.IOException
Throws:
java.io.IOException

readUnsignedInt

public abstract long readUnsignedInt()
                              throws java.io.IOException
Throws:
java.io.IOException

readUnsignedInt

public abstract long readUnsignedInt(int byteCount)
                              throws java.io.IOException
Throws:
java.io.IOException

readLEInt

public static int readLEInt(java.io.DataInput di)
                     throws java.io.IOException
Reads an int from a Little Endian (Intel) byte ordered source..

Throws:
java.io.IOException

readLEInt

public static int readLEInt(java.io.DataInput di,
                            int byteCount)
                     throws java.io.IOException
Reads N (0
Throws:
java.io.IOException

readLEShort

public static short readLEShort(java.io.DataInput di)
                         throws java.io.IOException
Reads a short from a Little Endian (Intel) byte ordered source..

Throws:
java.io.IOException

readLELong

public static long readLELong(java.io.DataInput di)
                       throws java.io.IOException
Reads a long from a Little Endian (Intel) byte ordered source..

Throws:
java.io.IOException

readLEUnsignedShort

public static int readLEUnsignedShort(java.io.DataInput di)
                               throws java.io.IOException
Throws:
java.io.IOException

readLEDouble

public static double readLEDouble(java.io.DataInput di)
                           throws java.io.IOException
Reads a double from a Little Endian (Intel) byte ordered source..

Throws:
java.io.IOException

readLEFloat

public static float readLEFloat(java.io.DataInput di)
                         throws java.io.IOException
Reads a float from a Little Endian (Intel) byte ordered source..

Throws:
java.io.IOException