public class StreamUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
copy(InputStream is, OutputStream os)
Copies the InputStream to the OutputStream using a 4k buffer.
|
static void |
copy(InputStream is, OutputStream os, int size)
Copies the InputStream to the OutputStream using a defined buffer size in bytes.
|
static void |
copy(Reader in, Writer out)
Copies a Reader to a Writer with an 4096 char buffer.
|
static void |
copy(Reader in, Writer out, int size)
Copies a Reader to a Writer with a buffer of
size characters. |
static int |
fill(byte[] buffer, InputStream is)
Reads data from the InputStream and tries to fill the buffer.
|
static InputStream |
getPartitionedInputStream(InputStream is, int len)
Returns an InputStream that is a partition of another InputStream.
|
static String |
toString(InputStream is, String encoding)
Returns a string representation of this input stream.
|
public static void copy(InputStream is, OutputStream os) throws IOException
is - The input stream.os - The ouput stream.IOException - if an I/O error occurs.public static void copy(InputStream is, OutputStream os, int size) throws IOException
is - The input stream.os - The ouput stream.size - The read/write buffer size.IOException - if an I/O error occurs.public static void copy(Reader in, Writer out) throws IOException
in - The input stream.out - The ouput stream.IOException - if an I/O error occurs.public static void copy(Reader in, Writer out, int size) throws IOException
size characters.in - The input stream.out - The ouput stream.size - The read/write buffer size.IOException - if an I/O error occurs.
public static int fill(byte[] buffer,
InputStream is)
throws IOException
buffer - buffer to be filled in.is - stream to read from.IOException - if an I/O error occurs.public static InputStream getPartitionedInputStream(InputStream is, int len)
is - The input stream.len - The bumber of bytes to be read.public static String toString(InputStream is, String encoding)
is - The input streamencoding - Encoding to be used to convert to a string.