public class StreamUtil extends Object
Constructor and Description |
---|
StreamUtil() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
readFile(Path path)
Fully reads a file into a byte array.
|
static byte[] |
readStream(InputStream inputStream)
Fully reads an input stream into a byte array.
|
static void |
streamToFile(InputStream inputStream,
Path path)
Fully streams an input stream into a file.
|
public static byte[] readStream(InputStream inputStream) throws IOException
inputStream
- the input stream to read.IOException
- if an error occurs in the process.public static byte[] readFile(Path path) throws IOException
path
- the path to the file to read.IOException
- if an error occurs in the process.public static void streamToFile(InputStream inputStream, Path path) throws IOException
inputStream
- the input stream to read.path
- the file to write to.IOException
- if an error occurs in the process.