org.simantics.databoard.util.binary
Class ByteBufferReadable

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

public class ByteBufferReadable
extends java.lang.Object
implements BinaryReadable


Constructor Summary
ByteBufferReadable(byte[] buf)
           
ByteBufferReadable(java.nio.ByteBuffer buf)
           
 
Method Summary
 long length()
           
 java.nio.ByteOrder order()
           
 void order(java.nio.ByteOrder order)
           
 long position()
           
 void position(int newPosition)
           
 void position(long newPosition)
           
 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
 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

ByteBufferReadable

public ByteBufferReadable(java.nio.ByteBuffer buf)

ByteBufferReadable

public ByteBufferReadable(byte[] buf)
Method Detail

readByte

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

readLine

public final 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

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)
Specified by:
readFully in interface java.io.DataInput

readFully

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

readFully

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

Specified by:
readFully in interface BinaryReadable

readFully

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

Specified by:
readFully in interface BinaryReadable

readDouble

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

readFloat

public float readFloat()
Specified by:
readFloat in interface java.io.DataInput

readInt

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

readLong

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

readShort

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

readUTF

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

readUnsignedShort

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

length

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

position

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

order

public java.nio.ByteOrder order()

order

public void order(java.nio.ByteOrder order)

position

public void position(int newPosition)
              throws java.io.IOException
Throws:
java.io.IOException

position

public void position(long newPosition)
              throws java.io.IOException
Throws:
java.io.IOException

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