org.bson.io
Class BSONByteBuffer

java.lang.Object
  extended by org.bson.io.BSONByteBuffer

public class BSONByteBuffer
extends Object

Pseudo byte buffer, delegates as it is too hard to properly override / extend the ByteBuffer API

Author:
brendan

Field Summary
protected  ByteBuffer buf
           
 
Method Summary
 byte[] array()
           
 boolean equals(Object o)
           
 ByteBuffer get(byte[] bytes)
           
 ByteBuffer get(byte[] bytes, int offset, int length)
           
 byte get(int i)
           
 String getCString(int offset)
           
 int getInt(int i)
          Gets a Little Endian Integer
 int getIntBE(int i)
           
 int getIntLE(int i)
           
 long getLong(int i)
           
 String getUTF8String(int valueOffset)
           
 int hashCode()
           
 Buffer position(int i)
           
 Buffer reset()
           
 int size()
           
 String toString()
           
static BSONByteBuffer wrap(byte[] bytes)
           
static BSONByteBuffer wrap(byte[] bytes, int offset, int length)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

buf

protected ByteBuffer buf
Method Detail

wrap

public static BSONByteBuffer wrap(byte[] bytes,
                                  int offset,
                                  int length)

wrap

public static BSONByteBuffer wrap(byte[] bytes)

get

public byte get(int i)

get

public ByteBuffer get(byte[] bytes,
                      int offset,
                      int length)

get

public ByteBuffer get(byte[] bytes)

array

public byte[] array()

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

getInt

public int getInt(int i)
Gets a Little Endian Integer

Parameters:
i - Index to read from
Returns:

getIntLE

public int getIntLE(int i)

getIntBE

public int getIntBE(int i)

getLong

public long getLong(int i)

getCString

public String getCString(int offset)

getUTF8String

public String getUTF8String(int valueOffset)

position

public Buffer position(int i)

reset

public Buffer reset()

size

public int size()