public class IoUtils extends Object
Modifier and Type | Field and Description |
---|---|
static long |
MAX_UNSIGNED_INT_VALUE |
static int |
MAX_UNSIGNED_SHORT_VALUE |
static int |
STANDARD_BUFFER_SIZE |
Constructor and Description |
---|
IoUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
copyStream(InputStream inputStream,
OutputStream output)
Copy the bytes from the input stream to the output stream.
|
static int |
readByte(InputStream input,
String label)
Read a byte from the input stream
|
static byte[] |
readBytes(InputStream input,
int size,
String label)
Read an array of bytes from the input stream.
|
static void |
readFully(InputStream input,
byte[] bytes,
int length,
String label)
Read all of the bytes into the buffer.
|
static int |
readInt(InputStream input,
String label)
Read an int in little-endian from the input stream.
|
static long |
readIntAsLong(InputStream input,
String label)
Read an int in little-endian from the input stream.
|
static long |
readLong(InputStream input,
String label)
Read a long in little-endian from the input stream.
|
static int |
readShort(InputStream input,
String label)
Read a short in little-endian from the input stream.
|
static void |
writeByte(OutputStream output,
int value)
Write a byte to the output stream.
|
static void |
writeBytes(OutputStream output,
byte[] bytes)
Write an array of bytes to the output stream.
|
static void |
writeInt(OutputStream output,
long value)
Write an int in little-endian to the output stream.
|
static void |
writeLong(OutputStream output,
long value)
Write a long in little-endian to the output stream.
|
static void |
writeShort(OutputStream output,
int value)
Write a short in little-endian to the output stream.
|
static void |
writeShortBytesLength(OutputStream output,
byte[] bytes)
Write the length of bytes as a little-endian short to the output stream.
|
public static int STANDARD_BUFFER_SIZE
public static int MAX_UNSIGNED_SHORT_VALUE
public static long MAX_UNSIGNED_INT_VALUE
public static int readByte(InputStream input, String label) throws IOException
IOException
- If end is reached or some io problem occurs.public static int readShort(InputStream input, String label) throws IOException
IOException
- If end is reached or some io problem occurs.public static int readInt(InputStream input, String label) throws IOException
IOException
- If end is reached or some io problem occurs.public static long readIntAsLong(InputStream input, String label) throws IOException
IOException
- If end is reached or some io problem occurs.public static long readLong(InputStream input, String label) throws IOException
IOException
- If end is reached or some io problem occurs.public static byte[] readBytes(InputStream input, int size, String label) throws IOException
IOException
- If end is reached or some io problem occurs.public static void writeByte(OutputStream output, int value) throws IOException
IOException
public static void writeShort(OutputStream output, int value) throws IOException
IOException
public static void writeInt(OutputStream output, long value) throws IOException
IOException
public static void writeLong(OutputStream output, long value) throws IOException
IOException
public static void writeShortBytesLength(OutputStream output, byte[] bytes) throws IOException
IOException
public static void writeBytes(OutputStream output, byte[] bytes) throws IOException
IOException
public static void copyStream(InputStream inputStream, OutputStream output) throws IOException
IOException
public static void readFully(InputStream input, byte[] bytes, int length, String label) throws IOException
IOException
This documentation content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.