Package org.bson.io
Class ByteBufferBsonInput
- java.lang.Object
- 
- org.bson.io.ByteBufferBsonInput
 
- 
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- BsonInput
 
 public class ByteBufferBsonInput extends Object implements BsonInput An implementation ofBsonInputthat is backed by aByteBuf.- Since:
- 3.0
 
- 
- 
Constructor SummaryConstructors Constructor Description ByteBufferBsonInput(ByteBuf buffer)Construct an instance with the given byte buffer.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()BsonInputMarkgetMark(int readLimit)Gets a mark for the current position in the stream.intgetPosition()Gets the current position in the streambooleanhasRemaining()Returns true if there are more bytes left in the stream.voidmark(int readLimit)Deprecated.bytereadByte()Reads a single byte from the streamvoidreadBytes(byte[] bytes)Reads the specified number of bytes into the given byte array.voidreadBytes(byte[] bytes, int offset, int length)Reads the specified number of bytes into the given byte array starting at the specified offset.StringreadCString()Reads a BSON CString value from the stream.doublereadDouble()Reads a BSON Double value from the stream.intreadInt32()Reads a BSON Int32 value from the stream.longreadInt64()Reads a BSON Int64 value from the stream.ObjectIdreadObjectId()Reads a BSON ObjectId value from the stream.StringreadString()Reads a BSON String value from the stream.voidreset()Deprecated.voidskip(int numBytes)Skips the specified number of bytes in the stream.voidskipCString()Skips a BSON CString value from the stream.
 
- 
- 
- 
Constructor Detail- 
ByteBufferBsonInputpublic ByteBufferBsonInput(ByteBuf buffer) Construct an instance with the given byte buffer. The stream takes over ownership of the buffer and closes it when this instance is closed.- Parameters:
- buffer- the byte buffer
 
 
- 
 - 
Method Detail- 
getPositionpublic int getPosition() Description copied from interface:BsonInputGets the current position in the stream- Specified by:
- getPositionin interface- BsonInput
- Returns:
- the current position
 
 - 
readBytepublic byte readByte() Description copied from interface:BsonInputReads a single byte from the stream
 - 
readBytespublic void readBytes(byte[] bytes) Description copied from interface:BsonInputReads the specified number of bytes into the given byte array. This is equivalent to toreadBytes(bytes, 0, bytes.length).
 - 
readBytespublic void readBytes(byte[] bytes, int offset, int length)Description copied from interface:BsonInputReads the specified number of bytes into the given byte array starting at the specified offset.
 - 
readInt64public long readInt64() Description copied from interface:BsonInputReads a BSON Int64 value from the stream.
 - 
readDoublepublic double readDouble() Description copied from interface:BsonInputReads a BSON Double value from the stream.- Specified by:
- readDoublein interface- BsonInput
- Returns:
- the double value
 
 - 
readInt32public int readInt32() Description copied from interface:BsonInputReads a BSON Int32 value from the stream.
 - 
readObjectIdpublic ObjectId readObjectId() Description copied from interface:BsonInputReads a BSON ObjectId value from the stream.- Specified by:
- readObjectIdin interface- BsonInput
- Returns:
- the ObjectId
 
 - 
readStringpublic String readString() Description copied from interface:BsonInputReads a BSON String value from the stream.- Specified by:
- readStringin interface- BsonInput
- Returns:
- the string
 
 - 
readCStringpublic String readCString() Description copied from interface:BsonInputReads a BSON CString value from the stream.- Specified by:
- readCStringin interface- BsonInput
- Returns:
- the CString
 
 - 
skipCStringpublic void skipCString() Description copied from interface:BsonInputSkips a BSON CString value from the stream.- Specified by:
- skipCStringin interface- BsonInput
 
 - 
skippublic void skip(int numBytes) Description copied from interface:BsonInputSkips the specified number of bytes in the stream.
 - 
mark@Deprecated public void mark(int readLimit) Deprecated.Description copied from interface:BsonInputMarks the current position in the stream. This method obeys the contract as specified in the same method inInputStream.
 - 
getMarkpublic BsonInputMark getMark(int readLimit) Description copied from interface:BsonInputGets a mark for the current position in the stream.
 - 
reset@Deprecated public void reset() Deprecated.Description copied from interface:BsonInputResets the stream to the current mark. This method obeys the contract as specified in the same method inInputStream.
 - 
hasRemainingpublic boolean hasRemaining() Description copied from interface:BsonInputReturns true if there are more bytes left in the stream.- Specified by:
- hasRemainingin interface- BsonInput
- Returns:
- true if there are more bytes left in the stream.
 
 
- 
 
-