AutoCloseable
, Closeable
ByteBufferBsonInput
public interface BsonInput extends Closeable
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
BsonInputMark |
getMark(int readLimit) |
Gets a mark for the current position in the stream.
|
int |
getPosition() |
Gets the current position in the stream
|
boolean |
hasRemaining() |
Returns true if there are more bytes left in the stream.
|
void |
mark(int readLimit) |
Deprecated.
Use
getMark(int) instead |
byte |
readByte() |
Reads a single byte from the stream
|
void |
readBytes(byte[] bytes) |
Reads the specified number of bytes into the given byte array.
|
void |
readBytes(byte[] bytes,
int offset,
int length) |
Reads the specified number of bytes into the given byte array starting at the specified offset.
|
String |
readCString() |
Reads a BSON CString value from the stream.
|
double |
readDouble() |
Reads a BSON Double value from the stream.
|
int |
readInt32() |
Reads a BSON Int32 value from the stream.
|
long |
readInt64() |
Reads a BSON Int64 value from the stream.
|
ObjectId |
readObjectId() |
Reads a BSON ObjectId value from the stream.
|
String |
readString() |
Reads a BSON String value from the stream.
|
void |
reset() |
Resets the stream to the current mark.
|
void |
skip(int numBytes) |
Skips the specified number of bytes in the stream.
|
void |
skipCString() |
Skips a BSON CString value from the stream.
|
int getPosition()
byte readByte()
void readBytes(byte[] bytes)
readBytes(bytes, 0, bytes.length)
.bytes
- the byte array to write intovoid readBytes(byte[] bytes, int offset, int length)
bytes
- the byte array to write intooffset
- the offset to start writinglength
- the number of bytes to writelong readInt64()
double readDouble()
int readInt32()
String readString()
ObjectId readObjectId()
String readCString()
void skipCString()
void skip(int numBytes)
numBytes
- the number of bytes to skip@Deprecated void mark(int readLimit)
getMark(int)
insteadInputStream
.readLimit
- the maximum limit of bytes that can be read before the mark position becomes invalidBsonInputMark getMark(int readLimit)
readLimit
- the maximum limit of bytes that can be read before the mark position becomes invalidvoid reset()
InputStream
.boolean hasRemaining()
void close()
close
in interface AutoCloseable
close
in interface Closeable