@Override
    public void encode(final BsonWriter writer, final DBObject document, final EncoderContext encoderContext) {
    """
	over an array of ByteBuffer instances from a PooledByteBufferOutputBuffer
    """
        BasicOutputBuffer buffer = new BasicOutputBuffer();
        try {
            encoder.writeObject(buffer, document);
            BsonBinaryReader reader = new BsonBinaryReader(new ByteBufferBsonInput(new ByteBufNIO(wrap(buffer.toByteArray()))));
            try {
                writer.pipe(reader);
            } finally {
                reader.close();
            }
        } finally {
            buffer.close();
        }
    }
@Override
    public void encode(final BsonWriter writer, final DBObject document, final EncoderContext encoderContext) {
        BasicOutputBuffer buffer = new BasicOutputBuffer();
        try {
            encoder.writeObject(buffer, document);
            BsonBinaryReader reader = new BsonBinaryReader(new ByteBufferBsonInput(new ByteBufNIO(wrap(buffer.toByteArray()))));
            try {
                writer.pipe(reader);
            } finally {
                reader.close();
            }
        } finally {
            buffer.close();
        }
    }
@ Override public void encode ( final BsonWriter writer , final DBObject document , final EncoderContext encoderContext ) { BasicOutputBuffer buffer = new BasicOutputBuffer ( ) ; try { encoder . writeObject ( buffer , document ) ; BsonBinaryReader reader = new BsonBinaryReader ( new ByteBufferBsonInput ( new ByteBufNIO ( wrap ( buffer . toByteArray ( ) ) ) ) ) ; try { writer . pipe ( reader ) ; } finally { reader . close ( ) ; } } finally { buffer . close ( ) ; } }
over an array of ByteBuffer instances from a PooledByteBufferOutputBuffer
over an array of ByteBuffer instances from a PooledByteBufferOutputBuffer