GF4J 0.9.4 Beta

gameframe.util
Class BigEndianDataInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.FilterInputStream
              |
              +--gameframe.util.BigEndianDataInputStream
All Implemented Interfaces:
java.io.DataInput

public class BigEndianDataInputStream
extends java.io.FilterInputStream
implements java.io.DataInput

Output stream filter that filters all input values to big endian format that is used e.g. by Intel processor equipped computers.

Since:
GameFrame for Java 0.9.3
Version:
GameFrame for Java 0.9.4

Field Summary
private  char[] m_achLineBuffer
           
protected  java.io.DataInputStream m_dataInStream
          This stream is used in case the basic methods are allright.
 
Fields inherited from class java.io.FilterInputStream
in
 
Fields inherited from class java.io.InputStream
SKIP_BUFFER_SIZE, skipBuffer
 
Constructor Summary
BigEndianDataInputStream(java.io.InputStream inputStream)
          Constructs an big endian input filter.
 
Method Summary
 int read()
          Reads an integer.
 int read(byte[] aByte)
          Reads the series of bytes in big endian format.
 int read(byte[] aByte, int offset, int length)
          Reads the series of bytes in big endian format.
 boolean readBoolean()
          Reads a boolean value.
 byte readByte()
          Reads a byte.
 char readChar()
          Reads a Unicode character.
 double readDouble()
          Reads a double value in big endian format.
 float readFloat()
          Reads a floating point value in big endian format.
 void readFully(byte[] aBytes)
          Reads some bytes from an input stream and stores them into the buffer array aBytes.
 void readFully(byte[] aBytes, int offset, int length)
          Reads some bytes from an input stream and stores them into the buffer array aBytes.
 int readInt()
          Reads a integer value in big endian format.
 java.lang.String readLine()
          Reads one line of text.
 long readLong()
          Reads a long value in big endian format.
 short readShort()
          Reads a short value in big endian format.
 int readUnsignedByte()
          Reads an unsigned byte.
 int readUnsignedShort()
          Reads an unsigned short value in big endian format.
 java.lang.String readUTF()
          Does nothing.
 int skipBytes(int numBytes)
          Skips the given number of bytes.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_dataInStream

protected java.io.DataInputStream m_dataInStream
This stream is used in case the basic methods are allright.

m_achLineBuffer

private char[] m_achLineBuffer
Constructor Detail

BigEndianDataInputStream

public BigEndianDataInputStream(java.io.InputStream inputStream)
Constructs an big endian input filter.
Parameters:
inputStream - The input stream to read from.
Method Detail

read

public int read()
         throws java.io.IOException
Reads an integer.
Overrides:
read in class java.io.FilterInputStream
Parameters:
integer - The integer that is read.

read

public int read(byte[] aByte)
         throws java.io.IOException
Reads the series of bytes in big endian format.
Overrides:
read in class java.io.FilterInputStream

read

public int read(byte[] aByte,
                int offset,
                int length)
         throws java.io.IOException
Reads the series of bytes in big endian format.
Overrides:
read in class java.io.FilterInputStream
Parameters:
offset - The offset into the array.
length - The length of the read array.

readFully

public void readFully(byte[] aBytes)
               throws java.io.IOException
Reads some bytes from an input stream and stores them into the buffer array aBytes. The number of bytes read is equal to the length of aBytes.
Specified by:
readFully in interface java.io.DataInput
Parameters:
aBytes - The buffer into which the data is read.

readFully

public final void readFully(byte[] aBytes,
                            int offset,
                            int length)
                     throws java.io.IOException
Reads some bytes from an input stream and stores them into the buffer array aBytes.
Specified by:
readFully in interface java.io.DataInput
Parameters:
aBytes - The buffer into which the data is read.
offset - The offset into the array.
length - The number of bytes to read.

skipBytes

public final int skipBytes(int numBytes)
                    throws java.io.IOException
Skips the given number of bytes.
Specified by:
skipBytes in interface java.io.DataInput
Parameters:
numBytes - The number of bytes that was skipped.
Returns:
The actual number of bytes skipped.

readLine

public final java.lang.String readLine()
                                throws java.io.IOException
Reads one line of text.
Specified by:
readLine in interface java.io.DataInput
Returns:
The line of text that was read.

readBoolean

public final boolean readBoolean()
                          throws java.io.IOException
Reads a boolean value.
Specified by:
readBoolean in interface java.io.DataInput
Returns:
The boolean value

readByte

public final byte readByte()
                    throws java.io.IOException
Reads a byte.
Specified by:
readByte in interface java.io.DataInput
Parameters:
byteValue - The byte that was read.

readUnsignedByte

public final int readUnsignedByte()
                           throws java.io.IOException
Reads an unsigned byte.
Specified by:
readUnsignedByte in interface java.io.DataInput
Returns:
The read byte.

readChar

public final char readChar()
                    throws java.io.IOException
Reads a Unicode character.
Specified by:
readChar in interface java.io.DataInput
Returns:
The character that was read.

readDouble

public final double readDouble()
                        throws java.io.IOException
Reads a double value in big endian format.
Specified by:
readDouble in interface java.io.DataInput
Returns:
The double value that was read.

readFloat

public final float readFloat()
                      throws java.io.IOException
Reads a floating point value in big endian format.
Specified by:
readFloat in interface java.io.DataInput
Returns:
The floating point value that was read.

readInt

public final int readInt()
                  throws java.io.IOException
Reads a integer value in big endian format.
Specified by:
readInt in interface java.io.DataInput
Returns:
The integer value that was read.

readLong

public final long readLong()
                    throws java.io.IOException
Reads a long value in big endian format.
Specified by:
readLong in interface java.io.DataInput
Returns:
The long value that was read.

readShort

public final short readShort()
                      throws java.io.IOException
Reads a short value in big endian format.
Specified by:
readShort in interface java.io.DataInput
Returns:
The short value that was read.

readUnsignedShort

public final int readUnsignedShort()
                            throws java.io.IOException
Reads an unsigned short value in big endian format.
Specified by:
readUnsignedShort in interface java.io.DataInput
Returns:
The short value that was read.

readUTF

public final java.lang.String readUTF()
                               throws java.io.IOException
Does nothing.
Specified by:
readUTF in interface java.io.DataInput
Returns:
Not used.

GF4J 0.9.4 Beta