public final class StreamUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
copy(InputStream is,
OutputStream os)
Copies the content read from InputStream to OutputStream.
|
static byte[] |
inputStream2Bytes(InputStream is)
Reads the InputStream and creates a byte[] of the content.
|
static String |
inputStream2String(InputStream is,
Charset charset)
Reads the stream and generates a String content using the charset specified.
|
public static String inputStream2String(InputStream is, Charset charset) throws IOException
is - InputStream as the input.charset - The charset to use to create the String object.IOExceptionpublic static byte[] inputStream2Bytes(InputStream is) throws IOException
is - The input InputStream.IOExceptionpublic static void copy(InputStream is, OutputStream os) throws IOException
is - The InputStream that is read.os - The OutputStream where the data is written.IOExceptionCopyright © 2014. All rights reserved.