org.bson.io
Class BSONByteBuffer
java.lang.Object
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
buf
protected ByteBuffer buf
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()