Package org.bson.io
Class Bits
- java.lang.Object
 - 
- org.bson.io.Bits
 
 
- 
Deprecated.there is no replacement for this utility class
@Deprecated public class Bits extends Object
Utility class for reading values from an input stream. 
- 
- 
Constructor Summary
Constructors Constructor Description Bits()Deprecated. 
- 
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidreadFully(InputStream inputStream, byte[] buffer)Deprecated.Reads bytes from the input stream and puts them into the given byte buffer.static voidreadFully(InputStream inputStream, byte[] buffer, int length)Deprecated.Reads bytes from the input stream and puts them into the given byte buffer.static voidreadFully(InputStream inputStream, byte[] buffer, int offset, int length)Deprecated.Reads bytes from the input stream and puts them into the given byte buffer.static intreadInt(byte[] buffer)Deprecated.Reads and returns a single integer value from the buffer.static intreadInt(byte[] buffer, int offset)Deprecated.Reads and returns a single integer value from the buffer.static intreadInt(InputStream inputStream)Deprecated.Reads and returns a single integer value from the input stream.static intreadInt(InputStream inputStream, byte[] buffer)Deprecated.Reads and returns a single integer value from the input stream.static intreadIntBE(byte[] buffer, int offset)Deprecated.Reads and returns a single big-endian integer valuestatic longreadLong(byte[] buffer)Deprecated.Reads and returns a single long value from the buffer.static longreadLong(byte[] buffer, int offset)Deprecated.Reads and returns a single long value from the buffer.static longreadLong(InputStream inputStream)Deprecated.Reads and returns a single long value from the input stream.static longreadLong(InputStream inputStream, byte[] buffer)Deprecated.Reads and returns a single long value from the input stream. 
 - 
 
- 
- 
Method Detail
- 
readFully
public static void readFully(InputStream inputStream, byte[] buffer) throws IOException
Deprecated.Reads bytes from the input stream and puts them into the given byte buffer. The equivalent of callingreadFully(java.io.InputStream, byte[], int, int)with an offset of zero and a length equal to the length of the buffer.- Parameters:
 inputStream- the input stream to read frombuffer- the buffer into which the data is read.- Throws:
 IOException- if there's an error reading from theinputStream
 
- 
readFully
public static void readFully(InputStream inputStream, byte[] buffer, int length) throws IOException
Deprecated.Reads bytes from the input stream and puts them into the given byte buffer. The equivalent of callingreadFully(java.io.InputStream, byte[], int, int)with an offset of zero.- Parameters:
 inputStream- the input stream to read frombuffer- the buffer into which the data is read.length- the maximum number of bytes to read.- Throws:
 IOException- if there's an error reading from theinputStream
 
- 
readFully
public static void readFully(InputStream inputStream, byte[] buffer, int offset, int length) throws IOException
Deprecated.Reads bytes from the input stream and puts them into the given byte buffer.- Parameters:
 inputStream- the input stream to read frombuffer- the buffer into which the data is read.offset- the start offset in arraybufferat which the data is written.length- the maximum number of bytes to read.- Throws:
 IOException- if there's an error reading from theinputStream- See Also:
 InputStream.read(byte[], int, int)
 
- 
readInt
public static int readInt(InputStream inputStream) throws IOException
Deprecated.Reads and returns a single integer value from the input stream.- Parameters:
 inputStream- the input stream to read from- Returns:
 - the integer value
 - Throws:
 IOException- if there's an error reading from theinputStream
 
- 
readInt
public static int readInt(InputStream inputStream, byte[] buffer) throws IOException
Deprecated.Reads and returns a single integer value from the input stream.- Parameters:
 inputStream- the input stream to read frombuffer- the buffer to write the input stream bytes into- Returns:
 - the integer value
 - Throws:
 IOException- if there's an error reading from theinputStream
 
- 
readInt
public static int readInt(byte[] buffer)
Deprecated.Reads and returns a single integer value from the buffer. The equivalent of callingreadInt(byte[], int)with an offset of zero.- Parameters:
 buffer- the buffer to read from- Returns:
 - the integer value
 
 
- 
readInt
public static int readInt(byte[] buffer, int offset)Deprecated.Reads and returns a single integer value from the buffer.- Parameters:
 buffer- the buffer to read fromoffset- the position to start reading from the buffer- Returns:
 - the integer value
 
 
- 
readIntBE
public static int readIntBE(byte[] buffer, int offset)Deprecated.Reads and returns a single big-endian integer value- Parameters:
 buffer- the buffer to read fromoffset- the position to start reading from the buffer- Returns:
 - the integer value
 
 
- 
readLong
public static long readLong(InputStream inputStream) throws IOException
Deprecated.Reads and returns a single long value from the input stream.- Parameters:
 inputStream- the input stream to read from- Returns:
 - the long value
 - Throws:
 IOException- if there's an error reading from theinputStream
 
- 
readLong
public static long readLong(InputStream inputStream, byte[] buffer) throws IOException
Deprecated.Reads and returns a single long value from the input stream.- Parameters:
 inputStream- the input stream to read frombuffer- the buffer to write the input stream bytes into- Returns:
 - the long value
 - Throws:
 IOException- if there's an error reading from theinputStream
 
- 
readLong
public static long readLong(byte[] buffer)
Deprecated.Reads and returns a single long value from the buffer. The equivalent of calledreadLong(byte[], int)with an offset of zero.- Parameters:
 buffer- the buffer to read from- Returns:
 - the long value
 
 
- 
readLong
public static long readLong(byte[] buffer, int offset)Deprecated.Reads and returns a single long value from the buffer.- Parameters:
 buffer- the buffer to read fromoffset- the position to start reading from the buffer- Returns:
 - the long value
 
 
 - 
 
 -