public class IOUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
readFully(java.io.InputStream stream,
byte[] bytes,
int offset,
int length)
Reads into a buffer from a stream, making multiple read calls if necessary.
|
static int |
readRemaining(java.io.InputStream stream,
byte[] bytes,
int offset,
int length)
Reads into a buffer from a stream, making multiple read calls if necessary returning the number
of bytes read until end of stream.
|
static void |
writeFully(java.io.OutputStream outputStream,
java.nio.ByteBuffer buffer)
Writes a buffer into a stream, making multiple write calls if necessary.
|
public static void readFully(java.io.InputStream stream, byte[] bytes, int offset, int length) throws java.io.IOException
stream
- an InputStream to read frombytes
- a buffer to write intooffset
- starting offset in the buffer for the datalength
- length of bytes to copy from the input stream to the bufferjava.io.EOFException
- if the end of the stream is reached before reading length bytesjava.io.IOException
- if there is an error while readingpublic static void writeFully(java.io.OutputStream outputStream, java.nio.ByteBuffer buffer) throws java.io.IOException
java.io.IOException
public static int readRemaining(java.io.InputStream stream, byte[] bytes, int offset, int length) throws java.io.IOException
stream
- an InputStream to read frombytes
- a buffer to write intooffset
- starting offset in the buffer for the datalength
- length of bytes to copy from the input stream to the bufferjava.io.IOException
- if there is an error while reading