* @param object the BSON object or BSON value; may not be null
* @return the bytes
* @throws IOException if there was a problem reading from the stream
*/
public byte[] write( Object object ) throws IOException {
BsonDataOutput buffer = new BsonDataOutput();
write(null, object, buffer);
ByteArrayOutputStream stream = new ByteArrayOutputStream(buffer.size());
buffer.writeTo(stream);
return stream.toByteArray();
}