Package org.bson.io
Class OutputBuffer
- java.lang.Object
-
- java.io.OutputStream
-
- org.bson.io.OutputBuffer
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable,BsonOutput
- Direct Known Subclasses:
BasicOutputBuffer,ByteBufferBsonOutput
@Deprecated(since="2022-10-31") public abstract class OutputBuffer extends java.io.OutputStream implements BsonOutput
Deprecated.Usage of this API is not supported in AEM as a Cloud Service.An abstract base class for classes implementingBsonOutput.
-
-
Constructor Summary
Constructors Constructor Description OutputBuffer()Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Deprecated.abstract java.util.List<ByteBuf>getByteBuffers()Deprecated.Get a list of byte buffers that are prepared to be read from; in other words, whose position is 0 and whose limit is the number of bytes that should read.abstract intpipe(java.io.OutputStream out)Deprecated.Pipe the contents of this output buffer into the given output streamintsize()Deprecated.Gets the output size in bytes.byte[]toByteArray()Deprecated.Gets a copy of the buffered bytes.java.lang.StringtoString()Deprecated.abstract voidtruncateToPosition(int newPosition)Deprecated.Truncates this stream to the new position.voidwrite(byte[] b)Deprecated.voidwrite(byte[] bytes, int offset, int length)Deprecated.voidwrite(int value)Deprecated.voidwriteBytes(byte[] bytes)Deprecated.Writes all the bytes in the byte array to the stream.voidwriteCString(java.lang.String value)Deprecated.Writes a BSON CString to the stream.voidwriteDouble(double x)Deprecated.Writes a BSON double to the stream.voidwriteInt(int value)Deprecated.Writes the given integer value to the buffer.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.voidwriteLong(long value)Deprecated.Writes the given long value to the buffer.voidwriteObjectId(ObjectId value)Deprecated.Writes a BSON ObjectId to the stream.voidwriteString(java.lang.String str)Deprecated.Writes a BSON String to the stream.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.bson.io.BsonOutput
getPosition, getSize, writeByte, writeBytes
-
-
-
-
Method Detail
-
write
public void write(byte[] b)
Deprecated.- Overrides:
writein classjava.io.OutputStream
-
close
public void close()
Deprecated.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceBsonOutput- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream
-
write
public void write(byte[] bytes, int offset, int length)Deprecated.- Overrides:
writein classjava.io.OutputStream
-
writeBytes
public void writeBytes(byte[] bytes)
Deprecated.Description copied from interface:BsonOutputWrites all the bytes in the byte array to the stream.- Specified by:
writeBytesin interfaceBsonOutput- Parameters:
bytes- the non-null byte array
-
writeInt32
public void writeInt32(int value)
Deprecated.Description copied from interface:BsonOutputWrites a 32-bit BSON integer to the stream.- Specified by:
writeInt32in interfaceBsonOutput- Parameters:
value- the value
-
writeInt32
public void writeInt32(int position, int value)Deprecated.Description copied from interface:BsonOutputWrites 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.- Specified by:
writeInt32in interfaceBsonOutput- 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
public void writeInt64(long value)
Deprecated.Description copied from interface:BsonOutputWrites a 64-bit BSON integer to the stream.- Specified by:
writeInt64in interfaceBsonOutput- Parameters:
value- the value
-
writeDouble
public void writeDouble(double x)
Deprecated.Description copied from interface:BsonOutputWrites a BSON double to the stream.- Specified by:
writeDoublein interfaceBsonOutput- Parameters:
x- the value
-
writeString
public void writeString(java.lang.String str)
Deprecated.Description copied from interface:BsonOutputWrites a BSON String to the stream.- Specified by:
writeStringin interfaceBsonOutput- Parameters:
str- the value
-
writeCString
public void writeCString(java.lang.String value)
Deprecated.Description copied from interface:BsonOutputWrites a BSON CString to the stream.- Specified by:
writeCStringin interfaceBsonOutput- Parameters:
value- the value
-
writeObjectId
public void writeObjectId(ObjectId value)
Deprecated.Description copied from interface:BsonOutputWrites a BSON ObjectId to the stream.- Specified by:
writeObjectIdin interfaceBsonOutput- Parameters:
value- the value
-
size
public int size()
Deprecated.Gets the output size in bytes.- Returns:
- the size
-
pipe
public abstract int pipe(java.io.OutputStream out) throws java.io.IOExceptionDeprecated.Pipe the contents of this output buffer into the given output stream- Parameters:
out- the stream to pipe to- Returns:
- number of bytes written to the stream
- Throws:
java.io.IOException- if the stream throws an exception
-
getByteBuffers
public abstract java.util.List<ByteBuf> getByteBuffers()
Deprecated.Get a list of byte buffers that are prepared to be read from; in other words, whose position is 0 and whose limit is the number of bytes that should read.Note that the byte buffers may be read-only.
- Returns:
- the non-null list of byte buffers, in LITTLE_ENDIAN order
-
truncateToPosition
public abstract void truncateToPosition(int newPosition)
Deprecated.Description copied from interface:BsonOutputTruncates this stream to the new position. After this call, both size and position will equal the new position.- Specified by:
truncateToPositionin interfaceBsonOutput- Parameters:
newPosition- the new position, which must be greater than or equal to 0 and less than the current size.
-
toByteArray
public byte[] toByteArray()
Deprecated.Gets a copy of the buffered bytes.- Returns:
- the byte array
- See Also:
pipe(java.io.OutputStream)
-
write
public void write(int value)
Deprecated.- Specified by:
writein classjava.io.OutputStream
-
writeInt
public void writeInt(int value)
Deprecated.Writes the given integer value to the buffer.- Parameters:
value- the value to write- See Also:
writeInt32(int)
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toStringin classjava.lang.Object
-
writeLong
public void writeLong(long value)
Deprecated.Writes the given long value to the buffer.- Parameters:
value- the value to write- See Also:
writeInt64(long)
-
-