public abstract class OutputBuffer extends java.io.OutputStream implements BsonOutput
BsonOutput
.Constructor and Description |
---|
OutputBuffer() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
abstract java.util.List<ByteBuf> |
getByteBuffers()
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 int |
pipe(java.io.OutputStream out)
Pipe the contents of this output buffer into the given output stream
|
int |
size()
Gets the output size in bytes.
|
byte[] |
toByteArray()
Gets a copy of the buffered bytes.
|
java.lang.String |
toString() |
abstract void |
truncateToPosition(int newPosition)
Truncates this stream to the new position.
|
void |
write(byte[] b) |
void |
write(byte[] bytes,
int offset,
int length) |
void |
write(int value) |
void |
writeBytes(byte[] bytes)
Writes all the bytes in the byte array to the stream.
|
void |
writeCString(java.lang.String value)
Writes a BSON CString to the stream.
|
void |
writeDouble(double x)
Writes a BSON double to the stream.
|
void |
writeInt(int value)
Writes the given integer value to the buffer.
|
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 |
writeLong(long value)
Writes the given long value to the buffer.
|
void |
writeObjectId(ObjectId value)
Writes a BSON ObjectId to the stream.
|
void |
writeString(java.lang.String str)
Writes a BSON String to the stream.
|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getPosition, getSize, writeByte, writeBytes
public void write(byte[] b)
write
in class java.io.OutputStream
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface BsonOutput
close
in class java.io.OutputStream
public void write(byte[] bytes, int offset, int length)
write
in class java.io.OutputStream
public void writeBytes(byte[] bytes)
BsonOutput
writeBytes
in interface BsonOutput
bytes
- the non-null byte arraypublic void writeInt32(int value)
BsonOutput
writeInt32
in interface BsonOutput
value
- the valuepublic void writeInt32(int position, int value)
BsonOutput
writeInt32
in interface BsonOutput
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 valuepublic void writeInt64(long value)
BsonOutput
writeInt64
in interface BsonOutput
value
- the valuepublic void writeDouble(double x)
BsonOutput
writeDouble
in interface BsonOutput
x
- the valuepublic void writeString(java.lang.String str)
BsonOutput
writeString
in interface BsonOutput
str
- the valuepublic void writeCString(java.lang.String value)
BsonOutput
writeCString
in interface BsonOutput
value
- the valuepublic void writeObjectId(ObjectId value)
BsonOutput
writeObjectId
in interface BsonOutput
value
- the valuepublic int size()
public abstract int pipe(java.io.OutputStream out) throws java.io.IOException
out
- the stream to pipe tojava.io.IOException
- if the stream throws an exceptionpublic abstract java.util.List<ByteBuf> getByteBuffers()
Note that the byte buffers may be read-only.
public abstract void truncateToPosition(int newPosition)
BsonOutput
truncateToPosition
in interface BsonOutput
newPosition
- the new position, which must be greater than or equal to 0 and less than the current size.public byte[] toByteArray()
pipe(java.io.OutputStream)
public void write(int value)
write
in class java.io.OutputStream
public void writeInt(int value)
value
- the value to writewriteInt32(int)
public java.lang.String toString()
toString
in class java.lang.Object
public void writeLong(long value)
value
- the value to writewriteInt64(long)
Copyright © 2010 - 2020 Adobe. All Rights Reserved