jcontrol.io
Class GenericDataInputStream

java.lang.Object
  extended by jcontrol.io.InputStream
      extended by jcontrol.io.DataInputStream
          extended by jcontrol.io.GenericDataInputStream

public class GenericDataInputStream
extends DataInputStream


Field Summary
protected  int m_endianess
          The stream's endianess.
protected  InputStream m_in
          The underlying InputStream.
 
Fields inherited from class jcontrol.io.DataInputStream
BIG_ENDIAN, LITTLE_ENDIAN
 
Constructor Summary
protected GenericDataInputStream(InputStream in, int endianess)
           
 
Method Summary
 int available()
          Returns the number of bytes immediately available for reading from this stream.
 void close()
          Closes the stream.
 void mark(int readlimit)
           
 boolean markSupported()
          Checks if mark() and reset() are supported by this stream.
 int read()
          Reads a single byte from the stream.
 void read(byte[] b, int start, int length)
          Reads an array of bytes from the stream.
 boolean readBoolean()
          Reads a boolean value, represented by a byte value of 0 (false) of 1 (true), from the stream.
 char readChar()
          Reads a char value from the stream.
 double readDouble()
          Reads a double value from the stream.
 float readFloat()
          Reads a float value from the stream.
 int readInt()
          Reads an int value from the stream.
 long readLong()
          Reads a long value from the stream.
 short readShort()
          Reads a short value from the stream.
 void reset()
           
 void skip(int length)
          Skips data from the stream.
 
Methods inherited from class jcontrol.io.DataInputStream
createDataInputStream, createDataInputStream
 
Methods inherited from class jcontrol.io.InputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Field Detail

m_in

protected InputStream m_in
The underlying InputStream.


m_endianess

protected int m_endianess
The stream's endianess.

Constructor Detail

GenericDataInputStream

protected GenericDataInputStream(InputStream in,
                                 int endianess)
Method Detail

readBoolean

public boolean readBoolean()
                    throws IOException
Description copied from class: DataInputStream
Reads a boolean value, represented by a byte value of 0 (false) of 1 (true), from the stream.

Specified by:
readBoolean in class DataInputStream
Returns:
boolean value
Throws:
IOException - occurs on I/O error or when the stream is closed

readChar

public char readChar()
              throws IOException
Description copied from class: DataInputStream
Reads a char value from the stream.

Specified by:
readChar in class DataInputStream
Returns:
char value
Throws:
IOException - occurs on I/O error or when the stream is closed

readDouble

public double readDouble()
                  throws IOException
Description copied from class: DataInputStream
Reads a double value from the stream.

Specified by:
readDouble in class DataInputStream
Returns:
double value
Throws:
IOException - occurs on I/O error or when the stream is closed

readFloat

public float readFloat()
                throws IOException
Description copied from class: DataInputStream
Reads a float value from the stream.

Specified by:
readFloat in class DataInputStream
Returns:
float value
Throws:
IOException - occurs on I/O error or when the stream is closed

readInt

public int readInt()
            throws IOException
Description copied from class: DataInputStream
Reads an int value from the stream.

Specified by:
readInt in class DataInputStream
Returns:
int value
Throws:
IOException - occurs on I/O error or when the stream is closed

readLong

public long readLong()
              throws IOException
Description copied from class: DataInputStream
Reads a long value from the stream.

Specified by:
readLong in class DataInputStream
Returns:
long value
Throws:
IOException - occurs on I/O error or when the stream is closed

readShort

public short readShort()
                throws IOException
Description copied from class: DataInputStream
Reads a short value from the stream.

Specified by:
readShort in class DataInputStream
Returns:
short value
Throws:
IOException - occurs on I/O error or when the stream is closed

available

public int available()
              throws IOException
Description copied from class: InputStream
Returns the number of bytes immediately available for reading from this stream.

Specified by:
available in class InputStream
Returns:
number of bytes immediately readable
Throws:
IOException - occurs on I/O errors or when the stream is closed

close

public void close()
           throws IOException
Description copied from class: InputStream
Closes the stream.

Specified by:
close in class InputStream
Throws:
IOException - if stream is already closed

mark

public void mark(int readlimit)
Specified by:
mark in class InputStream

markSupported

public boolean markSupported()
Description copied from class: InputStream
Checks if mark() and reset() are supported by this stream.

Specified by:
markSupported in class InputStream
Returns:
true if supported, false if not

read

public int read()
         throws IOException
Description copied from class: InputStream
Reads a single byte from the stream.

Specified by:
read in class InputStream
Returns:
byte value
Throws:
IOException - occurs on I/O errors or when the stream is closed

read

public void read(byte[] b,
                 int start,
                 int length)
          throws IOException
Description copied from class: InputStream
Reads an array of bytes from the stream. Data is placed at the specified location in the given array.

Specified by:
read in class InputStream
Parameters:
b - array where data is stored
start - offset within the data array
length - number of bytes to read
Throws:
IOException - occurs on I/O errors or when the stream is closed

reset

public void reset()
           throws IOException
Specified by:
reset in class InputStream
Throws:
IOException

skip

public void skip(int length)
          throws IOException
Description copied from class: InputStream
Skips data from the stream.

Specified by:
skip in class InputStream
Parameters:
length - number of bytes to skip
Throws:
IOException - occurs on I/O errors or when the stream is closed