public final class StreamHelpers
extends java.lang.Object
| Constructor and Description |
|---|
StreamHelpers() |
| Modifier and Type | Method and Description |
|---|---|
static int |
readAll(java.io.InputStream stream,
byte[] target,
int startOffset,
int maxLength)
Reads at most 'maxLength' bytes from the given input stream, as long as the stream still has data to serve.
|
static byte[] |
readAll(java.io.InputStream source,
int length)
Reads a number of bytes from the given InputStream and returns it as the given byte array.
|
public static int readAll(java.io.InputStream stream,
byte[] target,
int startOffset,
int maxLength)
throws java.io.IOException
stream - The InputStream to read from.target - The target array to write data to.startOffset - The offset within the target array to start writing data to.maxLength - The maximum number of bytes to copy.java.io.IOException - If unable to read from the given stream.public static byte[] readAll(java.io.InputStream source,
int length)
throws java.io.IOException
source - The InputStream to read.length - The number of bytes to read.java.io.IOException - If unable to read from the given InputStream.