org.simantics.databoard.util.binary
Class InputStreamReadable

java.lang.Object
  extended by org.simantics.databoard.util.binary.InputStreamReadable
All Implemented Interfaces:
java.io.DataInput, BinaryReadable

public class InputStreamReadable
extends java.lang.Object
implements BinaryReadable

Input stream reader

Author:
Toni Kalajainen (toni.kalajainen@vtt.fi)

Constructor Summary
InputStreamReadable(java.io.InputStream is, long limit)
           
 
Method Summary
 long length()
           
 long position()
           
 boolean readBoolean()
           
 byte readByte()
           
 char readChar()
           
 double readDouble()
           
 float readFloat()
           
 void readFully(byte[] dst)
           
 void readFully(byte[] dst, int offset, int length)
           
 void readFully(java.nio.ByteBuffer buf)
          Read buf fully
 void readFully(java.nio.ByteBuffer buf, int length)
          Read fully length bytes
static BinaryReadable readFully(java.io.InputStream is)
           
 int readInt()
           
 java.lang.String readLine()
           
 long readLong()
           
 short readShort()
           
 int readUnsignedByte()
           
 int readUnsignedShort()
           
 java.lang.String readUTF()
           
 int skipBytes(int bytes)
           
 long skipBytes(long bytes)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputStreamReadable

public InputStreamReadable(java.io.InputStream is,
                           long limit)
Method Detail

readFully

public static BinaryReadable readFully(java.io.InputStream is)
                                throws java.io.IOException
Throws:
java.io.IOException

readLine

public final java.lang.String readLine()
                                throws java.io.IOException
Specified by:
readLine 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

readUnsignedByte

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

readBoolean

public boolean readBoolean()
                    throws java.io.IOException
Specified by:
readBoolean in interface java.io.DataInput
Throws:
java.io.IOException

readFully

public void readFully(byte[] dst,
                      int offset,
                      int length)
               throws java.io.IOException
Specified by:
readFully in interface java.io.DataInput
Throws:
java.io.IOException

readFully

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

readFully

public void readFully(java.nio.ByteBuffer buf)
               throws java.io.IOException
Description copied from interface: BinaryReadable
Read buf fully

Specified by:
readFully in interface BinaryReadable
Throws:
java.io.IOException

readFully

public void readFully(java.nio.ByteBuffer buf,
                      int length)
               throws java.io.IOException
Description copied from interface: BinaryReadable
Read fully length bytes

Specified by:
readFully in interface BinaryReadable
Throws:
java.io.IOException

readDouble

public double readDouble()
                  throws java.io.IOException
Specified by:
readDouble in interface java.io.DataInput
Throws:
java.io.IOException

readFloat

public float readFloat()
                throws java.io.IOException
Specified by:
readFloat 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

readInt

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

readLong

public long readLong()
              throws java.io.IOException
Specified by:
readLong in interface java.io.DataInput
Throws:
java.io.IOException

readShort

public short readShort()
                throws java.io.IOException
Specified by:
readShort in interface java.io.DataInput
Throws:
java.io.IOException

readUnsignedShort

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

length

public long length()
Specified by:
length in interface BinaryReadable

position

public long position()
Specified by:
position in interface BinaryReadable

skipBytes

public long skipBytes(long bytes)
               throws java.io.IOException
Specified by:
skipBytes in interface BinaryReadable
Throws:
java.io.IOException

skipBytes

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