public final class StreamUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
blockSize
The data transfer block size.
|
Constructor and Description |
---|
StreamUtils() |
Modifier and Type | Method and Description |
---|---|
private static ByteArrayOutputStream |
readStream(InputStream input) |
static byte[] |
readStreamToByteArray(InputStream input)
Read all of the data from a stream, returning the contents as a
byte array. |
static OutputStream |
readStreamToStream(InputStream input,
OutputStream output)
Read all of the data from a stream, writing it to another stream.
|
static String |
readStreamToString(InputStream input)
Read all of the data from a stream, returning the contents as a
String . |
static void |
writeStringToStream(String s,
OutputStream output)
Write a string to a stream.
|
public static final int blockSize
public StreamUtils()
public static final OutputStream readStreamToStream(InputStream input, OutputStream output) throws IOException
input
- The input stream.output
- The output stream.IOException
- If an error occurred while reading from
the stream.public static final String readStreamToString(InputStream input) throws IOException
String
. Note that this method is not unicode-aware.input
- The stream to read from.String
.IOException
- If an error occurred while reading from
the stream.public static final void writeStringToStream(String s, OutputStream output) throws IOException
s
- The string to write.output
- The stream to write it to.IOException
- If an error occurred while writing to the
stream.public static final byte[] readStreamToByteArray(InputStream input) throws IOException
byte
array.input
- The stream to read from.byte
array.IOException
- If an error occurred while reading from
the stream.private static final ByteArrayOutputStream readStream(InputStream input) throws IOException
IOException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses