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
protected  boolean _isAscii(byte b)
           
 byte[] array()
           
 int arrayOffset()
           
 int compareTo(ByteBuffer byteBuffer)
           
 ByteBuffer duplicate()
           
 boolean equals(Object o)
           
 ByteBuffer get(byte[] bytes)
           
 ByteBuffer get(byte[] bytes, int offset, int length)
           
 byte get(int i)
           
 char getChar(int i)
           
 String getCString(int i)
           
 double getDouble(int i)
           
 float getFloat(int i)
           
 int getInt(int i)
          Gets a Little Endian Integer
 int getInt(int i, boolean littleEndian)
           
 int getIntBE(int i)
           
 int getIntLE(int i)
           
 long getLong(int i)
           
 short getShort(int i)
           
 String getUTF8String(int i)
           
 boolean hasArray()
           
 int hashCode()
           
 boolean hasRemaining()
           
 Buffer mark()
           
 ByteOrder order()
           
 Buffer position(int i)
           
 int remaining()
           
 Buffer reset()
           
 Buffer rewind()
           
 int size()
           
 ByteBuffer slice()
           
 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)

slice

public ByteBuffer slice()

duplicate

public ByteBuffer duplicate()

get

public byte get(int i)

get

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

get

public ByteBuffer get(byte[] bytes)

hasArray

public boolean hasArray()

array

public byte[] array()

arrayOffset

public int arrayOffset()

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

compareTo

public int compareTo(ByteBuffer byteBuffer)

order

public ByteOrder order()

getChar

public char getChar(int i)

getShort

public short getShort(int i)

getInt

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

Parameters:
i - Index to read from
Returns:

getInt

public int getInt(int i,
                  boolean littleEndian)

getIntLE

public int getIntLE(int i)

getIntBE

public int getIntBE(int i)

getLong

public long getLong(int i)

getFloat

public float getFloat(int i)

getDouble

public double getDouble(int i)

getCString

public String getCString(int i)

getUTF8String

public String getUTF8String(int i)

position

public Buffer position(int i)

mark

public Buffer mark()

reset

public Buffer reset()

rewind

public Buffer rewind()

remaining

public int remaining()

hasRemaining

public boolean hasRemaining()

_isAscii

protected boolean _isAscii(byte b)

size

public int size()