AutoCloseable, CloseableBasicOutputBuffer, ByteBufferBsonOutput, OutputBufferpublic interface BsonOutput extends Closeable
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
|
int |
getPosition() |
Gets the current position in the stream.
|
int |
getSize() |
Gets the current size of the stream in number of bytes.
|
void |
truncateToPosition(int newPosition) |
Truncates this stream to the new position.
|
void |
writeByte(int value) |
Write a single byte to the stream.
|
void |
writeBytes(byte[] bytes) |
Writes all the bytes in the byte array to the stream.
|
void |
writeBytes(byte[] bytes,
int offset,
int length) |
Writes
length bytes from the byte array, starting at offset. |
void |
writeCString(String value) |
Writes a BSON CString to the stream.
|
void |
writeDouble(double value) |
Writes a BSON double to the stream.
|
void |
writeInt32(int value) |
Writes a 32-bit BSON integer to the stream.
|
void |
writeInt32(int position,
int value) |
Writes a 32-bit BSON integer to the stream at the given position.
|
void |
writeInt64(long value) |
Writes a 64-bit BSON integer to the stream.
|
void |
writeObjectId(ObjectId value) |
Writes a BSON ObjectId to the stream.
|
void |
writeString(String value) |
Writes a BSON String to the stream.
|
int getPosition()
int getSize()
void truncateToPosition(int newPosition)
newPosition - the new position, which must be greater than or equal to 0 and less than the current size.void writeBytes(byte[] bytes)
bytes - the non-null byte arrayvoid writeBytes(byte[] bytes,
int offset,
int length)
length bytes from the byte array, starting at offset.bytes - the non-null byte arrayoffset - the offset to start writing fromlength - the number of bytes to writevoid writeByte(int value)
value - the valuevoid writeCString(String value)
value - the valuevoid writeString(String value)
value - the valuevoid writeDouble(double value)
value - the valuevoid writeInt32(int value)
value - the valuevoid writeInt32(int position,
int value)
position - the position to write the value, which must be greater than or equal to 0 and less than or equal to the current sizevalue - the valuevoid writeInt64(long value)
value - the valuevoid writeObjectId(ObjectId value)
value - the valuevoid close()
close in interface AutoCloseableclose in interface Closeable