Package org.bson.io
Interface BsonInput
- 
- All Superinterfaces:
- AutoCloseable,- Closeable
 - All Known Implementing Classes:
- ByteBufferBsonInput
 
 public interface BsonInput extends Closeable An input stream that is optimized for reading BSON values directly from the underlying stream.- Since:
- 3.0
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract 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.UsegetMark(int)insteadbytereadByte()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.PrefergetMark(int)voidskip(int numBytes)Skips the specified number of bytes in the stream.voidskipCString()Skips a BSON CString value from the stream.
 
- 
- 
- 
Method Detail- 
getPositionint getPosition() Gets the current position in the stream- Returns:
- the current position
 
 - 
readBytebyte readByte() Reads a single byte from the stream- Returns:
- the byte value
 
 - 
readBytesvoid readBytes(byte[] bytes) Reads the specified number of bytes into the given byte array. This is equivalent to toreadBytes(bytes, 0, bytes.length).- Parameters:
- bytes- the byte array to write into
 
 - 
readBytesvoid readBytes(byte[] bytes, int offset, int length)Reads the specified number of bytes into the given byte array starting at the specified offset.- Parameters:
- bytes- the byte array to write into
- offset- the offset to start writing
- length- the number of bytes to write
 
 - 
readInt64long readInt64() Reads a BSON Int64 value from the stream.- Returns:
- the Int64 value
 
 - 
readDoubledouble readDouble() Reads a BSON Double value from the stream.- Returns:
- the double value
 
 - 
readInt32int readInt32() Reads a BSON Int32 value from the stream.- Returns:
- the Int32 value
 
 - 
readStringString readString() Reads a BSON String value from the stream.- Returns:
- the string
 
 - 
readObjectIdObjectId readObjectId() Reads a BSON ObjectId value from the stream.- Returns:
- the ObjectId
 
 - 
readCStringString readCString() Reads a BSON CString value from the stream.- Returns:
- the CString
 
 - 
skipCStringvoid skipCString() Skips a BSON CString value from the stream.
 - 
skipvoid skip(int numBytes) Skips the specified number of bytes in the stream.- Parameters:
- numBytes- the number of bytes to skip
 
 - 
mark@Deprecated void mark(int readLimit) Deprecated.UsegetMark(int)insteadMarks the current position in the stream. This method obeys the contract as specified in the same method inInputStream.- Parameters:
- readLimit- the maximum limit of bytes that can be read before the mark position becomes invalid
 
 - 
getMarkBsonInputMark getMark(int readLimit) Gets a mark for the current position in the stream.- Parameters:
- readLimit- the maximum limit of bytes that can be read before the mark position becomes invalid
- Returns:
- the mark
- Since:
- 3.7
 
 - 
reset@Deprecated void reset() Deprecated.PrefergetMark(int)Resets the stream to the current mark. This method obeys the contract as specified in the same method inInputStream.
 - 
hasRemainingboolean hasRemaining() Returns true if there are more bytes left in the stream.- Returns:
- true if there are more bytes left in the stream.
 
 - 
closevoid close() - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
 
- 
 
-