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