Package org.bson.io
Interface BsonOutput
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable
- All Known Implementing Classes:
BasicOutputBuffer,ByteBufferBsonOutput,OutputBuffer
@Deprecated(since="2022-10-31") public interface BsonOutput extends java.io.CloseableDeprecated.An output stream that is optimized for writing BSON values directly to the underlying stream.- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidclose()Deprecated.intgetPosition()Deprecated.Gets the current position in the stream.intgetSize()Deprecated.Gets the current size of the stream in number of bytes.voidtruncateToPosition(int newPosition)Deprecated.Truncates this stream to the new position.voidwriteByte(int value)Deprecated.Write a single byte to the stream.voidwriteBytes(byte[] bytes)Deprecated.Writes all the bytes in the byte array to the stream.voidwriteBytes(byte[] bytes, int offset, int length)Deprecated.Writeslengthbytes from the byte array, starting atoffset.voidwriteCString(java.lang.String value)Deprecated.Writes a BSON CString to the stream.voidwriteDouble(double value)Deprecated.Writes a BSON double to the stream.voidwriteInt32(int value)Deprecated.Writes a 32-bit BSON integer to the stream.voidwriteInt32(int position, int value)Deprecated.Writes a 32-bit BSON integer to the stream at the given position.voidwriteInt64(long value)Deprecated.Writes a 64-bit BSON integer to the stream.voidwriteObjectId(ObjectId value)Deprecated.Writes a BSON ObjectId to the stream.voidwriteString(java.lang.String value)Deprecated.Writes a BSON String to the stream.
-
-
-
Method Detail
-
getPosition
int getPosition()
Deprecated.Gets the current position in the stream.- Returns:
- the current position
-
getSize
int getSize()
Deprecated.Gets the current size of the stream in number of bytes.- Returns:
- the size of the stream
-
truncateToPosition
void truncateToPosition(int newPosition)
Deprecated.Truncates this stream to the new position. After this call, both size and position will equal the new position.- Parameters:
newPosition- the new position, which must be greater than or equal to 0 and less than the current size.
-
writeBytes
void writeBytes(byte[] bytes)
Deprecated.Writes all the bytes in the byte array to the stream.- Parameters:
bytes- the non-null byte array
-
writeBytes
void writeBytes(byte[] bytes, int offset, int length)Deprecated.Writeslengthbytes from the byte array, starting atoffset.- Parameters:
bytes- the non-null byte arrayoffset- the offset to start writing fromlength- the number of bytes to write
-
writeByte
void writeByte(int value)
Deprecated.Write a single byte to the stream. The byte to be written is the eight low-order bits of the specified value. The 24 high-order bits of the value are ignored.- Parameters:
value- the value
-
writeCString
void writeCString(java.lang.String value)
Deprecated.Writes a BSON CString to the stream.- Parameters:
value- the value
-
writeString
void writeString(java.lang.String value)
Deprecated.Writes a BSON String to the stream.- Parameters:
value- the value
-
writeDouble
void writeDouble(double value)
Deprecated.Writes a BSON double to the stream.- Parameters:
value- the value
-
writeInt32
void writeInt32(int value)
Deprecated.Writes a 32-bit BSON integer to the stream.- Parameters:
value- the value
-
writeInt32
void writeInt32(int position, int value)Deprecated.Writes a 32-bit BSON integer to the stream at the given position. This is useful for patching in the size of a document once the last byte of it has been encoded and its size it known.- Parameters:
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 value
-
writeInt64
void writeInt64(long value)
Deprecated.Writes a 64-bit BSON integer to the stream.- Parameters:
value- the value
-
writeObjectId
void writeObjectId(ObjectId value)
Deprecated.Writes a BSON ObjectId to the stream.- Parameters:
value- the value
-
close
void close()
Deprecated.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-