public class BasicBSONEncoder extends Object implements BSONEncoder
Modifier and Type | Field and Description |
---|---|
protected OutputBuffer |
_buf |
Constructor and Description |
---|
BasicBSONEncoder() |
Modifier and Type | Method and Description |
---|---|
protected void |
_put(byte type,
String name)
Encodes the type and key.
|
protected int |
_put(String str)
puts as utf-8 string
|
protected void |
_putObjectField(String name,
Object val) |
protected void |
_putValueString(String s) |
void |
done() |
byte[] |
encode(BSONObject o) |
protected boolean |
handleSpecialObjects(String name,
BSONObject o) |
protected void |
putBinary(String name,
Binary val) |
protected void |
putBinary(String name,
byte[] data) |
protected void |
putBoolean(String name,
Boolean b) |
protected void |
putCode(String name,
Code code) |
protected void |
putCodeWScope(String name,
CodeWScope code) |
protected void |
putDate(String name,
Date d) |
protected void |
putNull(String name) |
protected void |
putNumber(String name,
Number n) |
int |
putObject(BSONObject o)
Encodes a
BSONObject . |
protected int |
putObject(String name,
BSONObject o)
this is really for embedded objects
|
protected void |
putObjectId(String name,
ObjectId oid) |
protected boolean |
putSpecial(String name,
Object o) |
protected void |
putString(String name,
String s) |
protected void |
putSymbol(String name,
Symbol s) |
protected void |
putTimestamp(String name,
BSONTimestamp ts) |
protected void |
putUndefined(String name) |
protected void |
putUUID(String name,
UUID val) |
void |
set(OutputBuffer out) |
void |
writeCString(String s) |
void |
writeInt(int x) |
void |
writeLong(long x) |
protected OutputBuffer _buf
public byte[] encode(BSONObject o)
encode
in interface BSONEncoder
public void set(OutputBuffer out)
set
in interface BSONEncoder
public void done()
done
in interface BSONEncoder
protected boolean handleSpecialObjects(String name, BSONObject o)
public int putObject(BSONObject o)
BSONObject
.
This is for the higher level api callsputObject
in interface BSONEncoder
o
- the object to encodeprotected int putObject(String name, BSONObject o)
protected void putNull(String name)
protected void putUndefined(String name)
protected void putTimestamp(String name, BSONTimestamp ts)
protected void putCodeWScope(String name, CodeWScope code)
protected void putBinary(String name, byte[] data)
protected void _put(byte type, String name)
protected void _putValueString(String s)
protected int _put(String str)
public void writeInt(int x)
public void writeLong(long x)
public void writeCString(String s)