org.simantics.databoard.util.binary
Class ByteBufferReadable

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

public class ByteBufferReadable
extends java.lang.Object
implements BinaryReadable, Seekable


Constructor Summary
ByteBufferReadable(byte[] buf)
           
ByteBufferReadable(java.nio.ByteBuffer buf)
           
 
Method Summary
 byte get()
           
 void get(byte[] dst)
           
 void get(byte[] dst, int offset, int length)
           
 void get(java.nio.ByteBuffer buf)
          Get buf fully
 void get(java.nio.ByteBuffer buf, int length)
          Get fully length bytes
 double getDouble()
           
 float getFloat()
           
 int getInt()
           
 long getLong()
           
 short getShort()
           
 long length()
           
 java.nio.ByteOrder order()
           
 void order(java.nio.ByteOrder order)
           
 long position()
          Get position
 void position(int newPosition)
           
 void position(long newPosition)
          Seek new position.
 void skip(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

get

public byte get()
Specified by:
get in interface BinaryReadable

get

public void get(byte[] dst,
                int offset,
                int length)
Specified by:
get in interface BinaryReadable

get

public void get(byte[] dst)
Specified by:
get in interface BinaryReadable

get

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

Specified by:
get in interface BinaryReadable

get

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

Specified by:
get in interface BinaryReadable

getDouble

public double getDouble()
Specified by:
getDouble in interface BinaryReadable

getFloat

public float getFloat()
Specified by:
getFloat in interface BinaryReadable

getInt

public int getInt()
Specified by:
getInt in interface BinaryReadable

getLong

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

getShort

public short getShort()
Specified by:
getShort in interface BinaryReadable

length

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

position

public long position()
Description copied from interface: Seekable
Get position

Specified by:
position in interface BinaryReadable
Specified by:
position in interface Seekable
Returns:
position

order

public java.nio.ByteOrder order()
Specified by:
order in interface BinaryReadable

order

public void order(java.nio.ByteOrder order)
Specified by:
order in interface BinaryReadable

position

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

position

public void position(long newPosition)
              throws java.io.IOException
Description copied from interface: Seekable
Seek new position. The next value will be written after the index of the given pointer.

Specified by:
position in interface Seekable
Parameters:
newPosition - new position
Throws:
java.io.IOException

skip

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