com.develop.io
Class LittleEndianInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended bycom.develop.io.LittleEndianInputStream
All Implemented Interfaces:
java.io.DataInput

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

Replica of DataInputStreamthat uses little endian format. Useful for dealing with Win32-based formats.


Constructor Summary
LittleEndianInputStream(java.io.InputStream in)
          Creates a FilterInputStream and saves its argument, the input stream in, for later use.
 
Method Summary
 int read(byte[] b)
          See the general contract of the read method of DataInput.
 int read(byte[] b, int off, int len)
          See the general contract of the read method of DataInput.
 boolean readBoolean()
          See the general contract of the readBoolean method of DataInput.
 byte readByte()
          See the general contract of the readByte method of DataInput.
 char readChar()
          See the general contract of the readChar method of DataInput.
 byte[] readCurrency()
           
 double readDouble()
          See the general contract of the readDouble method of DataInput.
 float readFloat()
          See the general contract of the readFloat method of DataInput.
 void readFully(byte[] b)
          See the general contract of the readFully method of DataInput.
 void readFully(byte[] b, int off, int len)
          See the general contract of the readFully method of DataInput.
 int readInt()
          See the general contract of the readInt method of DataInput.
 java.lang.String readLine()
           
 long readLong()
          See the general contract of the readLong method of DataInput.
 short readShort()
          See the general contract of the readShort method of DataInput.
 java.lang.String readStringUnicode()
           
 java.lang.String readUnicodeSz(int sizeHint)
           
 int readUnsignedByte()
          See the general contract of the readUnsignedByte method of DataInput.
 int readUnsignedShort()
          See the general contract of the readUnsignedShort method of DataInput.
 java.lang.String readUTF()
           
static java.lang.String readUTF(java.io.DataInput in)
           
 int skipBytes(int n)
          See the general contract of the skipBytes method of DataInput.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LittleEndianInputStream

public LittleEndianInputStream(java.io.InputStream in)
Creates a FilterInputStream and saves its argument, the input stream in, for later use. An internal

Parameters:
in - the input stream.
Method Detail

read

public final int read(byte[] b)
               throws java.io.IOException
See the general contract of the read method of DataInput.

Bytes for this operation are read from the contained input stream.

Parameters:
b - the buffer into which the data is read.
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Throws:
java.io.IOException - if an I/O error occurs.
See Also:
java.io.FilterInputStream#in, InputStream.read(byte[], int, int)

read

public final int read(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException
See the general contract of the read method of DataInput.

Bytes for this operation are read from the contained input stream.

Parameters:
b - the buffer into which the data is read.
off - the start offset of the data.
len - the maximum number of bytes read.
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Throws:
java.io.IOException - if an I/O error occurs.
See Also:
java.io.FilterInputStream#in, InputStream.read(byte[], int, int)

readFully

public final void readFully(byte[] b)
                     throws java.io.IOException
See the general contract of the readFully method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readFully in interface java.io.DataInput
Parameters:
b - the buffer into which the data is read.
Throws:
java.io.EOFException - if this input stream reaches the end before reading all the bytes.
java.io.IOException - if an I/O error occurs.
See Also:
java.io.FilterInputStream#in

readFully

public final void readFully(byte[] b,
                            int off,
                            int len)
                     throws java.io.IOException
See the general contract of the readFully method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readFully in interface java.io.DataInput
Parameters:
b - the buffer into which the data is read.
off - the start offset of the data.
len - the number of bytes to read.
Throws:
java.io.EOFException - if this input stream reaches the end before reading all the bytes.
java.io.IOException - if an I/O error occurs.
See Also:
java.io.FilterInputStream#in

skipBytes

public final int skipBytes(int n)
                    throws java.io.IOException
See the general contract of the skipBytes method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
skipBytes in interface java.io.DataInput
Parameters:
n - the number of bytes to be skipped.
Returns:
the actual number of bytes skipped.
Throws:
java.io.IOException - if an I/O error occurs.

readBoolean

public final boolean readBoolean()
                          throws java.io.IOException
See the general contract of the readBoolean method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readBoolean in interface java.io.DataInput
Returns:
the boolean value read.
Throws:
java.io.EOFException - if this input stream has reached the end.
java.io.IOException - if an I/O error occurs.
See Also:
java.io.FilterInputStream#in

readByte

public final byte readByte()
                    throws java.io.IOException
See the general contract of the readByte method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readByte in interface java.io.DataInput
Returns:
the next byte of this input stream as a signed 8-bit byte.
Throws:
java.io.EOFException - if this input stream has reached the end.
java.io.IOException - if an I/O error occurs.
See Also:
java.io.FilterInputStream#in

readUnsignedByte

public final int readUnsignedByte()
                           throws java.io.IOException
See the general contract of the readUnsignedByte method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readUnsignedByte in interface java.io.DataInput
Returns:
the next byte of this input stream, interpreted as an unsigned 8-bit number.
Throws:
java.io.EOFException - if this input stream has reached the end.
java.io.IOException - if an I/O error occurs.
See Also:
java.io.FilterInputStream#in

readShort

public final short readShort()
                      throws java.io.IOException
See the general contract of the readShort method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readShort in interface java.io.DataInput
Returns:
the next two bytes of this input stream, interpreted as a signed 16-bit number.
Throws:
java.io.EOFException - if this input stream reaches the end before reading two bytes.
java.io.IOException - if an I/O error occurs.
See Also:
java.io.FilterInputStream#in

readUnsignedShort

public final int readUnsignedShort()
                            throws java.io.IOException
See the general contract of the readUnsignedShort method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readUnsignedShort in interface java.io.DataInput
Returns:
the next two bytes of this input stream, interpreted as an unsigned 16-bit integer.
Throws:
java.io.EOFException - if this input stream reaches the end before reading two bytes.
java.io.IOException - if an I/O error occurs.
See Also:
java.io.FilterInputStream#in

readChar

public final char readChar()
                    throws java.io.IOException
See the general contract of the readChar method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readChar in interface java.io.DataInput
Returns:
the next two bytes of this input stream as a Unicode character.
Throws:
java.io.EOFException - if this input stream reaches the end before reading two bytes.
java.io.IOException - if an I/O error occurs.
See Also:
java.io.FilterInputStream#in

readInt

public final int readInt()
                  throws java.io.IOException
See the general contract of the readInt method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readInt in interface java.io.DataInput
Returns:
the next four bytes of this input stream, interpreted as an int.
Throws:
java.io.EOFException - if this input stream reaches the end before reading four bytes.
java.io.IOException - if an I/O error occurs.
See Also:
java.io.FilterInputStream#in

readLong

public final long readLong()
                    throws java.io.IOException
See the general contract of the readLong method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readLong in interface java.io.DataInput
Returns:
the next eight bytes of this input stream, interpreted as a long.
Throws:
java.io.EOFException - if this input stream reaches the end before reading eight bytes.
java.io.IOException - if an I/O error occurs.
See Also:
java.io.FilterInputStream#in

readUnicodeSz

public final java.lang.String readUnicodeSz(int sizeHint)
                                     throws java.io.IOException
Throws:
java.io.IOException

readFloat

public final float readFloat()
                      throws java.io.IOException
See the general contract of the readFloat method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readFloat in interface java.io.DataInput
Returns:
the next four bytes of this input stream, interpreted as a float.
Throws:
java.io.EOFException - if this input stream reaches the end before reading four bytes.
java.io.IOException - if an I/O error occurs.
See Also:
DataInputStream.readInt(), Float.intBitsToFloat(int)

readDouble

public final double readDouble()
                        throws java.io.IOException
See the general contract of the readDouble method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readDouble in interface java.io.DataInput
Returns:
the next eight bytes of this input stream, interpreted as a double.
Throws:
java.io.EOFException - if this input stream reaches the end before reading eight bytes.
java.io.IOException - if an I/O error occurs.
See Also:
DataInputStream.readLong(), Double.longBitsToDouble(long)

readLine

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

readUTF

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

readUTF

public static final java.lang.String readUTF(java.io.DataInput in)
                                      throws java.io.IOException
Parameters:
in -
Returns:
Throws:
java.io.IOException

readStringUnicode

public final java.lang.String readStringUnicode()
                                         throws java.io.IOException
Returns:
Throws:
java.io.IOException

readCurrency

public final byte[] readCurrency()
                          throws java.io.IOException
Returns:
Throws:
java.io.IOException


Composia Soft Ltd. Designed by Vitally Shelest. .