Package org.bson.io
Class Bits
java.lang.Object
org.bson.io.Bits
Deprecated.
there is no replacement for this utility class
Utility class for reading values from an input stream.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
readFully
(InputStream inputStream, byte[] buffer) Deprecated.Reads bytes from the input stream and puts them into the given byte buffer.static void
readFully
(InputStream inputStream, byte[] buffer, int length) Deprecated.Reads bytes from the input stream and puts them into the given byte buffer.static void
readFully
(InputStream inputStream, byte[] buffer, int offset, int length) Deprecated.Reads bytes from the input stream and puts them into the given byte buffer.static int
readInt
(byte[] buffer) Deprecated.Reads and returns a single integer value from the buffer.static int
readInt
(byte[] buffer, int offset) Deprecated.Reads and returns a single integer value from the buffer.static int
readInt
(InputStream inputStream) Deprecated.Reads and returns a single integer value from the input stream.static int
readInt
(InputStream inputStream, byte[] buffer) Deprecated.Reads and returns a single integer value from the input stream.static int
readIntBE
(byte[] buffer, int offset) Deprecated.Reads and returns a single big-endian integer valuestatic long
readLong
(byte[] buffer) Deprecated.Reads and returns a single long value from the buffer.static long
readLong
(byte[] buffer, int offset) Deprecated.Reads and returns a single long value from the buffer.static long
readLong
(InputStream inputStream) Deprecated.Reads and returns a single long value from the input stream.static long
readLong
(InputStream inputStream, byte[] buffer) Deprecated.Reads and returns a single long value from the input stream.
-
Constructor Details
-
Bits
public Bits()Deprecated.
-
-
Method Details
-
readFully
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
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 arraybuffer
at 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:
-
readInt
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
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
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
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
-