| Modifier and Type | Field and Description |
|---|---|
static int |
EOF
Represents the end-of-file (or stream).
|
| Modifier and Type | Method and Description |
|---|---|
static long |
copy(InputStream input,
OutputStream output,
int bufferSize)
Copies bytes from an
InputStream to an OutputStream using
an internal buffer of the given size. |
static void |
copy(InputStream input,
Writer output,
Charset inputEncoding)
Copies bytes from an
InputStream to chars on a Writer
using the specified character encoding. |
static int |
copy(Reader input,
Writer output)
Copies chars from a
Reader to a Writer. |
static long |
copyLarge(InputStream input,
OutputStream output)
Copies bytes from a large (over 2GB)
InputStream to an
OutputStream. |
static long |
copyLarge(InputStream input,
OutputStream output,
byte[] buffer)
Copies bytes from a large (over 2GB)
InputStream to an
OutputStream. |
static long |
copyLarge(Reader input,
Writer output)
Copies chars from a large (over 2GB)
Reader to a Writer. |
static long |
copyLarge(Reader input,
Writer output,
char[] buffer)
Copies chars from a large (over 2GB)
Reader to a Writer. |
static String |
toString(InputStream input,
Charset encoding)
Gets the contents of an
InputStream as a String using the specified
character encoding. |
public static final int EOF
public static String toString(InputStream input, Charset encoding) throws IOException
InputStream as a String using the specified
character encoding.
This method buffers the input internally, so there is no need to use a
BufferedInputStream.
input - the InputStream to read fromencoding - the encoding to use, null means platform defaultNullPointerException - if the input is nullIOException - if an I/O error occurspublic static int copy(Reader input, Writer output) throws IOException
Reader to a Writer.
This method buffers the input internally, so there is no need to use a
BufferedReader.
Large streams (over 2GB) will return a chars copied value of -1 after
the copy has completed since the correct number of chars cannot be returned as an
int. For large streams use the copyLarge(Reader, Writer) method.
input - the Reader to read fromoutput - the Writer to write toNullPointerException - if the input or output is nullIOException - if an I/O error occurspublic static void copy(InputStream input, Writer output, Charset inputEncoding) throws IOException
InputStream to chars on a Writer
using the specified character encoding.
This method buffers the input internally, so there is no need to use a
BufferedInputStream.
This method uses InputStreamReader.
input - the InputStream to read fromoutput - the Writer to write toinputEncoding - the encoding to use for the input stream, null means platform
defaultNullPointerException - if the input or output is nullIOException - if an I/O error occurspublic static long copy(InputStream input, OutputStream output, int bufferSize) throws IOException
InputStream to an OutputStream using
an internal buffer of the given size.
This method buffers the input internally, so there is no need to use a
BufferedInputStream.
input - the InputStream to read fromoutput - the OutputStream to write tobufferSize - the bufferSize used to copy from the input to the outputNullPointerException - if the input or output is nullIOException - if an I/O error occurspublic static long copyLarge(Reader input, Writer output) throws IOException
Reader to a Writer.
This method buffers the input internally, so there is no need to use a
BufferedReader.
The buffer size is given by DEFAULT_BUFFER_SIZE.
input - the Reader to read fromoutput - the Writer to write toNullPointerException - if the input or output is nullIOException - if an I/O error occurspublic static long copyLarge(Reader input, Writer output, char[] buffer) throws IOException
Reader to a Writer.
This method uses the provided buffer, so there is no need to use a
BufferedReader.
input - the Reader to read fromoutput - the Writer to write tobuffer - the buffer to be used for the copyNullPointerException - if the input or output is nullIOException - if an I/O error occurspublic static long copyLarge(InputStream input, OutputStream output) throws IOException
InputStream to an
OutputStream.
This method buffers the input internally, so there is no need to use a
BufferedInputStream.
The buffer size is given by DEFAULT_BUFFER_SIZE.
input - the InputStream to read fromoutput - the OutputStream to write toNullPointerException - if the input or output is nullIOException - if an I/O error occurspublic static long copyLarge(InputStream input, OutputStream output, byte[] buffer) throws IOException
InputStream to an
OutputStream.
This method uses the provided buffer, so there is no need to use a
BufferedInputStream.
input - the InputStream to read fromoutput - the OutputStream to write tobuffer - the buffer to use for the copyNullPointerException - if the input or output is nullIOException - if an I/O error occursCopyright © 2021 Pivotal Software, Inc.. All rights reserved.