|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ejdb.bson.io.OutputBuffer
public class OutputBuffer
Utility class for serialize BSON object
Field Summary | |
---|---|
static int |
BUFFER_DEFAULT_LENGTH
|
Constructor Summary | |
---|---|
OutputBuffer()
|
Method Summary | |
---|---|
protected void |
ensureLength(int need)
Checks internal array size to hold needed data and expand it if need. |
int |
getActualSize()
Returns actual (full) size of buffer (currently writed bytes) |
int |
getPosition()
Returns current position in output |
byte[] |
getResult()
Returns buffer as byte array |
void |
setPosition(int position)
Sets position |
void |
write(byte data)
Writes single byte to buffer |
void |
write(byte[] data)
Writes byte array to buffer |
void |
write(byte[] data,
int offset,
int length)
Writes part of byte array to buffer |
void |
writeDouble(double value)
Writes double value to buffers as 8 bytes |
void |
writeInt(int value)
Writes integer value to buffer as 4 bytes |
void |
writeIntAt(int position,
int value)
Writes integer value (4 bytes) at specified position |
void |
writeLong(long value)
Writes long value to buffer as 8 bytes |
int |
writeString(java.lang.String value)
Writes String to buffer as c-style string (null-terminated) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BUFFER_DEFAULT_LENGTH
Constructor Detail |
---|
public OutputBuffer()
Method Detail |
---|
public int getPosition()
public void setPosition(int position)
public int getActualSize()
public byte[] getResult()
public void write(byte data)
public void write(byte[] data)
public void write(byte[] data, int offset, int length)
data
- source byte arrayoffset
- start position in sourcelength
- count bytes to writepublic void writeIntAt(int position, int value)
position
- position to writevalue
- valuepublic void writeInt(int value)
public void writeLong(long value)
public void writeDouble(double value)
public int writeString(java.lang.String value)
String
to buffer as c-style string (null-terminated)
protected void ensureLength(int need)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |