public class Bits
extends java.lang.Object
Constructor and Description |
---|
Bits() |
Modifier and Type | Method and Description |
---|---|
static void |
readFully(java.io.InputStream inputStream,
byte[] buffer)
Reads bytes from the input stream and puts them into the given byte buffer.
|
static void |
readFully(java.io.InputStream inputStream,
byte[] buffer,
int length)
Reads bytes from the input stream and puts them into the given byte buffer.
|
static void |
readFully(java.io.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(java.io.InputStream inputStream)
Reads and returns a single integer value from the input stream.
|
static int |
readInt(java.io.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(java.io.InputStream inputStream)
Reads and returns a single long value from the input stream.
|
static long |
readLong(java.io.InputStream inputStream,
byte[] buffer)
Reads and returns a single long value from the input stream.
|
public static void readFully(java.io.InputStream inputStream, byte[] buffer) throws java.io.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.java.io.IOException
- if there's an error reading from the inputStream
public static void readFully(java.io.InputStream inputStream, byte[] buffer, int length) throws java.io.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.java.io.IOException
- if there's an error reading from the inputStream
public static void readFully(java.io.InputStream inputStream, byte[] buffer, int offset, int length) throws java.io.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.java.io.IOException
- if there's an error reading from the inputStream
InputStream.read(byte[], int, int)
public static int readInt(java.io.InputStream inputStream) throws java.io.IOException
inputStream
- the input stream to read fromjava.io.IOException
- if there's an error reading from the inputStream
public static int readInt(java.io.InputStream inputStream, byte[] buffer) throws java.io.IOException
inputStream
- the input stream to read frombuffer
- the buffer to write the input stream bytes intojava.io.IOException
- 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(java.io.InputStream inputStream) throws java.io.IOException
inputStream
- the input stream to read fromjava.io.IOException
- if there's an error reading from the inputStream
public static long readLong(java.io.InputStream inputStream, byte[] buffer) throws java.io.IOException
inputStream
- the input stream to read frombuffer
- the buffer to write the input stream bytes intojava.io.IOException
- 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