public class BasicBSONEncoder extends Object implements BSONEncoder
Modifier and Type | Field and Description |
---|---|
protected OutputBuffer |
_buf
Deprecated.
Replaced by
getOutputBuffer() . |
Constructor and Description |
---|
BasicBSONEncoder() |
Modifier and Type | Method and Description |
---|---|
protected void |
_put(byte type,
String name)
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
Access buffer directly via
getOutputBuffer() if you need to change how BSON is written. |
protected int |
_put(String str)
Deprecated.
Replaced by
getOutputBuffer().writeCString(String) . |
protected void |
_putObjectField(String name,
Object val) |
protected void |
_putValueString(String s)
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
Access buffer directly via
getOutputBuffer() if you need to change how BSON is written.
Otherwise override putString(String, String) . |
void |
done() |
byte[] |
encode(BSONObject o) |
protected OutputBuffer |
getOutputBuffer()
Gets the buffer this encoder is writing to.
|
protected boolean |
handleSpecialObjects(String name,
BSONObject o)
Deprecated.
Override
putSpecial(String, Object) if you need to you need to handle custom types. |
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)
Deprecated.
Replaced by
getOutputBuffer().writeCString(String) . |
void |
writeInt(int x)
Deprecated.
Replaced by
getOutputBuffer().writeInt(int) . |
void |
writeLong(long x)
Deprecated.
Replaced by
getOutputBuffer().writeLong(long) . |
@Deprecated protected OutputBuffer _buf
getOutputBuffer()
.public byte[] encode(BSONObject o)
encode
in interface BSONEncoder
public void set(OutputBuffer out)
set
in interface BSONEncoder
protected OutputBuffer getOutputBuffer()
public void done()
done
in interface BSONEncoder
@Deprecated protected boolean handleSpecialObjects(String name, BSONObject o)
putSpecial(String, Object)
if you need to you need to handle custom types.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)
@Deprecated protected void _put(byte type, String name)
getOutputBuffer()
if you need to change how BSON is written.@Deprecated protected void _putValueString(String s)
getOutputBuffer()
if you need to change how BSON is written.
Otherwise override putString(String, String)
.@Deprecated protected int _put(String str)
getOutputBuffer().writeCString(String)
.@Deprecated public void writeInt(int x)
getOutputBuffer().writeInt(int)
.x
- the integer number@Deprecated public void writeLong(long x)
getOutputBuffer().writeLong(long)
.x
- the long number@Deprecated public void writeCString(String s)
getOutputBuffer().writeCString(String)
.s
- the string