public interface BSONEncoder
A BSONEncoder
is a class which can be used to turn documents into byte arrays. The BSONEncoder
walks down through the
object graph and writes corresponding byte
sequences into underlying OutputBuffer
.
This class is a part of legacy API. Please check org.bson.codecs.Encoder
for a new one.
Modifier and Type | Method and Description |
---|---|
void |
done()
Free the resources.
|
byte[] |
encode(BSONObject o)
Encode a document into byte array.
|
int |
putObject(BSONObject o)
Encoder and write a document into underlying buffer.
|
void |
set(OutputBuffer buffer)
Sets the buffer to wrich the result of encoding will be written.
|
byte[] encode(BSONObject o)
OutputBuffer
, invokes the other 3 methods in
a corresponding sequence:
and returns the contents of the OutputBuffer
.o
- the document to be encodedint putObject(BSONObject o)
o
- the document to be encodedvoid done()
void set(OutputBuffer buffer)
buffer
- the buffer to be used to write a byte sequences to