Modifier and Type | Field and Description |
---|---|
private ByteBuf |
buffer |
private int |
mark |
private static java.lang.String[] |
ONE_BYTE_ASCII_STRINGS |
private static java.nio.charset.Charset |
UTF8_CHARSET |
Constructor and Description |
---|
ByteBufferBsonInput(ByteBuf buffer)
Construct an instance with the given byte buffer.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
private void |
ensureAvailable(int bytesNeeded) |
private void |
ensureOpen() |
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)
Marks the current position in the stream.
|
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.
|
java.lang.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.
|
java.lang.String |
readString()
Reads a BSON String value from the stream.
|
private java.lang.String |
readString(int size) |
private void |
readUntilNullByte() |
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.
|
private static final java.nio.charset.Charset UTF8_CHARSET
private static final java.lang.String[] ONE_BYTE_ASCII_STRINGS
private ByteBuf buffer
private int mark
public ByteBufferBsonInput(ByteBuf buffer)
buffer
- the byte bufferpublic int getPosition()
BsonInput
getPosition
in interface BsonInput
public byte readByte()
BsonInput
public void readBytes(byte[] bytes)
BsonInput
readBytes(bytes, 0, bytes.length)
.public void readBytes(byte[] bytes, int offset, int length)
BsonInput
public long readInt64()
BsonInput
public double readDouble()
BsonInput
readDouble
in interface BsonInput
public int readInt32()
BsonInput
public ObjectId readObjectId()
BsonInput
readObjectId
in interface BsonInput
public java.lang.String readString()
BsonInput
readString
in interface BsonInput
public java.lang.String readCString()
BsonInput
readCString
in interface BsonInput
private java.lang.String readString(int size)
private void readUntilNullByte()
public void skipCString()
BsonInput
skipCString
in interface BsonInput
public void skip(int numBytes)
BsonInput
public void mark(int readLimit)
BsonInput
InputStream
.public void reset()
BsonInput
InputStream
.public boolean hasRemaining()
BsonInput
hasRemaining
in interface BsonInput
public void close()
private void ensureOpen()
private void ensureAvailable(int bytesNeeded)