public class Bits extends Object
Constructor and Description |
---|
Bits() |
Modifier and Type | Method and Description |
---|---|
static void |
readFully(InputStream in,
byte[] b)
Reads bytes from the input stream and puts them into the given byte buffer.
|
static void |
readFully(InputStream in,
byte[] b,
int length)
Reads bytes from the input stream and puts them into the given byte buffer.
|
static void |
readFully(InputStream in,
byte[] b,
int startOffset,
int length)
Reads bytes from the input stream and puts them into the given byte buffer.
|
static int |
readInt(byte[] data)
Reads and returns a single integer value from the buffer.
|
static int |
readInt(byte[] data,
int offset)
Reads and returns a single integer value from the buffer.
|
static int |
readInt(InputStream in)
Reads and returns a single integer value from the input stream.
|
static int |
readInt(InputStream in,
byte[] data)
Reads and returns a single integer value from the input stream.
|
static int |
readIntBE(byte[] data,
int offset)
Reads and returns a single big-endian integer value
|
static long |
readLong(byte[] data)
Reads and returns a single long value from the buffer.
|
static long |
readLong(byte[] data,
int offset)
Reads and returns a single long value from the buffer.
|
static long |
readLong(InputStream in)
Reads and returns a single long value from the input stream.
|
static long |
readLong(InputStream in,
byte[] data)
Reads and returns a single long value from the input stream.
|
public static void readFully(InputStream in, byte[] b) throws IOException
readFully(java.io.InputStream, byte[], int, int)
with an offset of zero and a length equal to the length of the buffer.in
- the input stream to read fromb
- the buffer into which the data is read.IOException
- if there's an error reading from the in
public static void readFully(InputStream in, byte[] b, int length) throws IOException
readFully(java.io.InputStream, byte[], int, int)
with an offset of zero.in
- the input stream to read fromb
- the buffer into which the data is read.length
- the maximum number of bytes to read.IOException
- if there's an error reading from the in
public static void readFully(InputStream in, byte[] b, int startOffset, int length) throws IOException
in
- the input stream to read fromb
- the buffer into which the data is read.startOffset
- the start offset in array b
at which the data is written.length
- the maximum number of bytes to read.IOException
- if there's an error reading from the in
InputStream.read(byte[], int, int)
public static int readInt(InputStream in) throws IOException
in
- the input stream to read fromIOException
- if there's an error reading from the in
public static int readInt(InputStream in, byte[] data) throws IOException
in
- the input stream to read fromdata
- the buffer to write the input stream bytes intoIOException
- if there's an error reading from the in
public static int readInt(byte[] data)
readInt(byte[], int)
with an offset of
zero.data
- the buffer to read frompublic static int readInt(byte[] data, int offset)
data
- the buffer to read fromoffset
- the position to start reading from the bufferpublic static int readIntBE(byte[] data, int offset)
data
- the buffer to read fromoffset
- the position to start reading from the bufferpublic static long readLong(InputStream in) throws IOException
in
- the input stream to read fromIOException
- if there's an error reading from the in
public static long readLong(InputStream in, byte[] data) throws IOException
in
- the input stream to read fromdata
- the buffer to write the input stream bytes intoIOException
- if there's an error reading from the in
public static long readLong(byte[] data)
readLong(byte[], int)
with an offset of
zero.data
- the buffer to read frompublic static long readLong(byte[] data, int offset)
data
- the buffer to read fromoffset
- the position to start reading from the buffer