public final class InputStreams
extends java.lang.Object
InputStream
s.Modifier and Type | Method and Description |
---|---|
static byte[] |
readFully(java.io.InputStream inputStream)
Returns a
byte array with the data read from inputStream . |
static java.io.BufferedInputStream |
toBufferedInputStream(java.io.InputStream inputStream)
Returns a
BufferedInputStream with inputStream as the source stream. |
public static java.io.BufferedInputStream toBufferedInputStream(java.io.InputStream inputStream)
BufferedInputStream
with inputStream
as the source stream.
If inputStream
is an instance of BufferedInputStream
, it is cast to it and returned. Otherwise a new BufferedInputStream
is created with inputStream
as its underlying stream.
If inputStream
is null
, a NullPointerException
will be thrown.
inputStream
- the source streamBufferedInputStream
with inputStream
as the source streamjava.lang.NullPointerException
- thrown if, and only if, inputStream
is null
public static byte[] readFully(java.io.InputStream inputStream) throws java.io.IOException
byte
array with the data read from inputStream
.
If inputStream
is null
, a NullPointerException
will be thrown.
If an I/O error occurs while reading, an IOException
will be thrown.
inputStream
- the InputStream
to read frombyte
array with the data read from inputStream
java.io.IOException
- thrown if, and only if, an I/O error occurs while readingjava.lang.NullPointerException
- thrown if, and only if, inputStream
is null