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