public class StreamUtil
extends java.lang.Object
| Constructor and Description |
|---|
StreamUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
close(java.io.Closeable closeable)
Closes silently the closable object.
|
static boolean |
compare(java.io.InputStream input1,
java.io.InputStream input2)
Compares the content of two byte streams (
InputStreams). |
static boolean |
compare(java.io.Reader input1,
java.io.Reader input2)
Compares the content of two character streams (
Readers). |
static FastCharArrayWriter |
copy(javax.activation.DataSource input)
Copies data from
DataSource to a new FastCharArrayWriter and returns this. |
static FastCharArrayWriter |
copy(java.io.InputStream input) |
static FastCharArrayWriter |
copy(java.io.InputStream input,
int count) |
static int |
copy(java.io.InputStream input,
java.io.OutputStream output)
Copies bytes from
InputStream to OutputStream using buffer. |
static int |
copy(java.io.InputStream input,
java.io.OutputStream output,
int count)
Copies specified number of bytes from
InputStream to OutputStream using buffer. |
static FastCharArrayWriter |
copy(java.io.InputStream input,
java.lang.String encoding) |
static FastCharArrayWriter |
copy(java.io.InputStream input,
java.lang.String encoding,
int count)
Copies
InputStream to a new FastCharArrayWriter using buffer and specified encoding. |
static <T extends java.io.Writer> |
copy(java.io.InputStream input,
T output) |
static <T extends java.io.Writer> |
copy(java.io.InputStream input,
T output,
int count) |
static <T extends java.io.Writer> |
copy(java.io.InputStream input,
T output,
java.lang.String encoding) |
static <T extends java.io.Writer> |
copy(java.io.InputStream input,
T output,
java.lang.String encoding,
int count)
Copies
InputStream to Writer using buffer and specified encoding. |
static FastCharArrayWriter |
copy(java.io.Reader input) |
static FastCharArrayWriter |
copy(java.io.Reader input,
int count)
Copies
Reader to a new FastCharArrayWriter using buffer and specified encoding. |
static <T extends java.io.OutputStream> |
copy(java.io.Reader input,
T output) |
static <T extends java.io.OutputStream> |
copy(java.io.Reader input,
T output,
int count) |
static <T extends java.io.OutputStream> |
copy(java.io.Reader input,
T output,
java.lang.String encoding) |
static <T extends java.io.OutputStream> |
copy(java.io.Reader input,
T output,
java.lang.String encoding,
int count)
Copies
Reader to OutputStream using buffer and specified encoding. |
static int |
copy(java.io.Reader input,
java.io.Writer output)
Copies bytes from
Reader to Writer using buffer. |
static int |
copy(java.io.Reader input,
java.io.Writer output,
int count)
Copies specified number of characters from
Reader to Writer using buffer. |
static FastByteArrayOutputStream |
copyToOutputStream(javax.activation.DataSource input)
Copies data from
DataSource to a new FastByteArrayOutputStream and returns this. |
static FastByteArrayOutputStream |
copyToOutputStream(java.io.InputStream input) |
static FastByteArrayOutputStream |
copyToOutputStream(java.io.InputStream input,
int count)
Copies
InputStream to a new FastByteArrayOutputStream using buffer and specified encoding. |
static FastByteArrayOutputStream |
copyToOutputStream(java.io.Reader input) |
static FastByteArrayOutputStream |
copyToOutputStream(java.io.Reader input,
int count) |
static FastByteArrayOutputStream |
copyToOutputStream(java.io.Reader input,
java.lang.String encoding) |
static FastByteArrayOutputStream |
copyToOutputStream(java.io.Reader input,
java.lang.String encoding,
int count)
Copies
Reader to a new FastByteArrayOutputStream using buffer and specified encoding. |
static java.io.InputStreamReader |
inputStreamReadeOf(java.io.InputStream input) |
static java.io.InputStreamReader |
inputStreamReadeOf(java.io.InputStream input,
java.lang.String encoding)
Returns new
InputStreamReader using specified InputStream and encoding. |
static java.io.OutputStreamWriter |
outputStreamWriterOf(java.io.OutputStream output) |
static java.io.OutputStreamWriter |
outputStreamWriterOf(java.io.OutputStream output,
java.lang.String encoding)
Returns new
OutputStreamWriter using specified OutputStream and encoding. |
static byte[] |
readAvailableBytes(java.io.InputStream input)
Reads all available bytes from
InputStream as a byte array. |
static byte[] |
readBytes(java.io.InputStream input) |
static byte[] |
readBytes(java.io.InputStream input,
int count) |
static byte[] |
readBytes(java.io.Reader input) |
static byte[] |
readBytes(java.io.Reader input,
int count) |
static byte[] |
readBytes(java.io.Reader input,
java.lang.String encoding) |
static byte[] |
readBytes(java.io.Reader input,
java.lang.String encoding,
int count) |
static char[] |
readChars(java.io.InputStream input) |
static char[] |
readChars(java.io.InputStream input,
int count) |
static char[] |
readChars(java.io.InputStream input,
java.lang.String encoding) |
static char[] |
readChars(java.io.InputStream input,
java.lang.String encoding,
int count) |
static char[] |
readChars(java.io.Reader input) |
static char[] |
readChars(java.io.Reader input,
int count) |
public static void close(java.io.Closeable closeable)
Flushable, it
will be flushed first. No exception will be thrown if an I/O error occurs.public static int copy(java.io.Reader input,
java.io.Writer output)
throws java.io.IOException
Reader to Writer using buffer.
Reader and Writer don't have to be wrapped to buffered, since copying is already optimized.input - Reader to read.output - Writer to write to.java.io.IOException - if there is an error reading or writing.public static int copy(java.io.InputStream input,
java.io.OutputStream output)
throws java.io.IOException
InputStream to OutputStream using buffer.
InputStream and OutputStream don't have to be wrapped to buffered,
since copying is already optimized.input - InputStream to read.output - OutputStream to write to.java.io.IOException - if there is an error reading or writing.public static int copy(java.io.Reader input,
java.io.Writer output,
int count)
throws java.io.IOException
Reader to Writer using buffer.
Reader and Writer don't have to be wrapped to buffered, since copying is already optimized.input - Reader to read.output - Writer to write to.count - The number of characters to read.java.io.IOException - if there is an error reading or writing.public static int copy(java.io.InputStream input,
java.io.OutputStream output,
int count)
throws java.io.IOException
InputStream to OutputStream using buffer.
InputStream and OutputStream don't have to be wrapped to buffered, since copying is already optimized.input - InputStream to read.output - OutputStream to write to.count - The number of bytes to read.java.io.IOException - if there is an error reading or writing.public static byte[] readAvailableBytes(java.io.InputStream input)
throws java.io.IOException
InputStream as a byte array.
Uses InputStream.available() to determine the size of input stream.
This is the fastest method for reading InputStream to byte array, but
depends on InputStream implementation of InputStream.available().input - InputStream to read.java.io.IOException - if total read is less than InputStream.available();public static <T extends java.io.OutputStream> T copy(java.io.Reader input,
T output)
throws java.io.IOException
java.io.IOExceptioncopy(Reader, OutputStream, String)public static <T extends java.io.OutputStream> T copy(java.io.Reader input,
T output,
int count)
throws java.io.IOException
java.io.IOExceptioncopy(Reader, OutputStream, String, int)public static <T extends java.io.OutputStream> T copy(java.io.Reader input,
T output,
java.lang.String encoding)
throws java.io.IOException
java.io.IOExceptioncopy(Reader, OutputStream, String, int)public static <T extends java.io.OutputStream> T copy(java.io.Reader input,
T output,
java.lang.String encoding,
int count)
throws java.io.IOException
Reader to OutputStream using buffer and specified encoding.java.io.IOExceptioncopy(Reader, Writer, int)public static FastByteArrayOutputStream copyToOutputStream(javax.activation.DataSource input) throws java.io.IOException
DataSource to a new FastByteArrayOutputStream and returns this.input - DataSource to copy from.FastByteArrayOutputStream with data from input.java.io.IOExceptioncopyToOutputStream(InputStream)public static FastByteArrayOutputStream copyToOutputStream(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptioncopyToOutputStream(InputStream, int)public static FastByteArrayOutputStream copyToOutputStream(java.io.InputStream input, int count) throws java.io.IOException
InputStream to a new FastByteArrayOutputStream using buffer and specified encoding.java.io.IOExceptioncopy(InputStream, OutputStream, int)public static FastByteArrayOutputStream copyToOutputStream(java.io.Reader input) throws java.io.IOException
java.io.IOExceptioncopyToOutputStream(Reader, String)public static FastByteArrayOutputStream copyToOutputStream(java.io.Reader input, java.lang.String encoding) throws java.io.IOException
java.io.IOExceptioncopyToOutputStream(Reader, String, int)public static FastByteArrayOutputStream copyToOutputStream(java.io.Reader input, int count) throws java.io.IOException
java.io.IOExceptioncopyToOutputStream(Reader, String, int)public static FastByteArrayOutputStream copyToOutputStream(java.io.Reader input, java.lang.String encoding, int count) throws java.io.IOException
Reader to a new FastByteArrayOutputStream using buffer and specified encoding.java.io.IOExceptioncopy(Reader, OutputStream, String, int)public static <T extends java.io.Writer> T copy(java.io.InputStream input,
T output)
throws java.io.IOException
java.io.IOExceptioncopy(InputStream, Writer, String)public static <T extends java.io.Writer> T copy(java.io.InputStream input,
T output,
int count)
throws java.io.IOException
java.io.IOExceptioncopy(InputStream, Writer, String, int)public static <T extends java.io.Writer> T copy(java.io.InputStream input,
T output,
java.lang.String encoding)
throws java.io.IOException
java.io.IOExceptioncopy(InputStream, Writer, String, int)public static <T extends java.io.Writer> T copy(java.io.InputStream input,
T output,
java.lang.String encoding,
int count)
throws java.io.IOException
InputStream to Writer using buffer and specified encoding.java.io.IOExceptioncopy(Reader, Writer, int)public static FastCharArrayWriter copy(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptioncopy(InputStream, String)public static FastCharArrayWriter copy(java.io.InputStream input, int count) throws java.io.IOException
java.io.IOExceptioncopy(InputStream, String, int)public static FastCharArrayWriter copy(java.io.InputStream input, java.lang.String encoding) throws java.io.IOException
java.io.IOExceptioncopy(InputStream, String, int)public static FastCharArrayWriter copy(java.io.InputStream input, java.lang.String encoding, int count) throws java.io.IOException
InputStream to a new FastCharArrayWriter using buffer and specified encoding.java.io.IOExceptioncopy(InputStream, Writer, String, int)public static FastCharArrayWriter copy(java.io.Reader input) throws java.io.IOException
java.io.IOExceptioncopy(Reader, int)public static FastCharArrayWriter copy(java.io.Reader input, int count) throws java.io.IOException
Reader to a new FastCharArrayWriter using buffer and specified encoding.java.io.IOExceptioncopy(Reader, Writer, int)public static FastCharArrayWriter copy(javax.activation.DataSource input) throws java.io.IOException
DataSource to a new FastCharArrayWriter and returns this.input - DataSource to copy from.FastCharArrayWriter with data from input.java.io.IOExceptioncopy(InputStream)public static byte[] readBytes(java.io.InputStream input)
throws java.io.IOException
java.io.IOExceptionreadBytes(InputStream, int)public static byte[] readBytes(java.io.InputStream input,
int count)
throws java.io.IOException
java.io.IOExceptioncopyToOutputStream(InputStream, int)public static byte[] readBytes(java.io.Reader input)
throws java.io.IOException
java.io.IOExceptionreadBytes(Reader, String)public static byte[] readBytes(java.io.Reader input,
int count)
throws java.io.IOException
java.io.IOExceptionreadBytes(Reader, String, int)public static byte[] readBytes(java.io.Reader input,
java.lang.String encoding)
throws java.io.IOException
java.io.IOExceptionreadBytes(Reader, String, int)public static byte[] readBytes(java.io.Reader input,
java.lang.String encoding,
int count)
throws java.io.IOException
java.io.IOExceptioncopyToOutputStream(Reader, String, int)public static char[] readChars(java.io.Reader input)
throws java.io.IOException
java.io.IOExceptionreadChars(Reader, int)public static char[] readChars(java.io.Reader input,
int count)
throws java.io.IOException
java.io.IOExceptioncopy(Reader, int)public static char[] readChars(java.io.InputStream input)
throws java.io.IOException
java.io.IOExceptionreadChars(InputStream, int)public static char[] readChars(java.io.InputStream input,
java.lang.String encoding)
throws java.io.IOException
java.io.IOExceptionreadChars(InputStream, String, int)public static char[] readChars(java.io.InputStream input,
int count)
throws java.io.IOException
java.io.IOExceptionreadChars(InputStream, String, int)public static char[] readChars(java.io.InputStream input,
java.lang.String encoding,
int count)
throws java.io.IOException
java.io.IOExceptioncopy(InputStream, String, int)public static boolean compare(java.io.InputStream input1,
java.io.InputStream input2)
throws java.io.IOException
InputStreams).true if the content of the first InputStream is equal
to the content of the second InputStream.java.io.IOExceptionpublic static boolean compare(java.io.Reader input1,
java.io.Reader input2)
throws java.io.IOException
Readers).true if the content of the first Reader is equal
to the content of the second Reader.java.io.IOExceptionpublic static java.io.InputStreamReader inputStreamReadeOf(java.io.InputStream input)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptioninputStreamReadeOf(InputStream, String)public static java.io.InputStreamReader inputStreamReadeOf(java.io.InputStream input,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
InputStreamReader using specified InputStream and encoding.input - InputStreamencoding - Encoding as String to use for InputStreamReader.InputStreamReaderjava.io.UnsupportedEncodingException - if encoding is not valid.public static java.io.OutputStreamWriter outputStreamWriterOf(java.io.OutputStream output)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionoutputStreamWriterOf(OutputStream, String)public static java.io.OutputStreamWriter outputStreamWriterOf(java.io.OutputStream output,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
OutputStreamWriter using specified OutputStream and encoding.output - OutputStreamencoding - Encoding as String to use for OutputStreamWriter.OutputStreamWriterjava.io.UnsupportedEncodingException - if encoding is not valid.Copyright © 2003-present Jodd Team