public final class IOUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
static java.nio.charset.Charset |
UTF8_CHARSET |
| Modifier and Type | Method and Description |
|---|---|
static void |
consume(java.io.InputStream in) |
static void |
consume(java.io.InputStream input,
int atLeast)
Consumes at least the given number of bytes from the input stream
|
static int |
copy(java.io.InputStream input,
java.io.OutputStream output) |
static int |
copy(java.io.InputStream input,
java.io.OutputStream output,
int bufferSize) |
static void |
copy(java.io.Reader input,
java.io.Writer output,
int bufferSize) |
static int |
copyAndCloseInput(java.io.InputStream input,
java.io.OutputStream output) |
static int |
copyAndCloseInput(java.io.InputStream input,
java.io.OutputStream output,
int bufferSize) |
static void |
copyAndCloseInput(java.io.Reader input,
java.io.Writer output) |
static void |
copyAndCloseInput(java.io.Reader input,
java.io.Writer output,
int bufferSize) |
static void |
copyAtLeast(java.io.InputStream input,
java.io.OutputStream output,
int atLeast)
Copy at least the specified number of bytes from the input to the output
or until the inputstream is finished.
|
static void |
copyAtLeast(java.io.Reader input,
java.io.Writer output,
int atLeast) |
static boolean |
isEmpty(java.io.InputStream is) |
static java.io.ByteArrayInputStream |
loadIntoBAIS(java.io.InputStream in)
Load the InputStream into memory and return a ByteArrayInputStream that
represents it.
|
static java.lang.String |
newStringFromBytes(byte[] bytes)
Use this function instead of new String(byte[]) to avoid surprises from non-standard default encodings.
|
static java.lang.String |
newStringFromBytes(byte[] bytes,
int start,
int length)
Use this function instead of new String(byte[], int, int)
to avoid surprises from non-standard default encodings.
|
static java.lang.String |
newStringFromBytes(byte[] bytes,
java.lang.String charsetName)
Use this function instead of new String(byte[], String) to avoid surprises from
non-standard default encodings.
|
static java.lang.String |
newStringFromBytes(byte[] bytes,
java.lang.String charsetName,
int start,
int length)
Use this function instead of new String(byte[], int, int, String)
to avoid surprises from non-standard default encodings.
|
static byte[] |
readBytesFromStream(java.io.InputStream in) |
static java.lang.String |
readStringFromStream(java.io.InputStream in) |
static java.lang.String |
toString(java.io.InputStream input) |
static java.lang.String |
toString(java.io.InputStream input,
int bufferSize) |
static java.lang.String |
toString(java.io.InputStream input,
int bufferSize,
java.lang.String charset) |
static java.lang.String |
toString(java.io.InputStream input,
java.lang.String charset) |
static java.lang.String |
toString(java.io.Reader input) |
static java.lang.String |
toString(java.io.Reader input,
int bufSize) |
static void |
transferTo(java.io.InputStream inputStream,
java.io.File destinationFile) |
public static final java.nio.charset.Charset UTF8_CHARSET
public static final int DEFAULT_BUFFER_SIZE
public static boolean isEmpty(java.io.InputStream is)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String newStringFromBytes(byte[] bytes,
java.lang.String charsetName)
bytes - charsetName - public static java.lang.String newStringFromBytes(byte[] bytes)
bytes - public static java.lang.String newStringFromBytes(byte[] bytes,
java.lang.String charsetName,
int start,
int length)
bytes - charsetName - start - length - public static java.lang.String newStringFromBytes(byte[] bytes,
int start,
int length)
bytes - start - length - public static int copy(java.io.InputStream input,
java.io.OutputStream output)
throws java.io.IOException
java.io.IOExceptionpublic static int copyAndCloseInput(java.io.InputStream input,
java.io.OutputStream output)
throws java.io.IOException
java.io.IOExceptionpublic static int copyAndCloseInput(java.io.InputStream input,
java.io.OutputStream output,
int bufferSize)
throws java.io.IOException
java.io.IOExceptionpublic static void copyAndCloseInput(java.io.Reader input,
java.io.Writer output)
throws java.io.IOException
java.io.IOExceptionpublic static void copyAndCloseInput(java.io.Reader input,
java.io.Writer output,
int bufferSize)
throws java.io.IOException
java.io.IOExceptionpublic static int copy(java.io.InputStream input,
java.io.OutputStream output,
int bufferSize)
throws java.io.IOException
java.io.IOExceptionpublic static void copyAtLeast(java.io.InputStream input,
java.io.OutputStream output,
int atLeast)
throws java.io.IOException
input - output - atLeast - java.io.IOExceptionpublic static void copyAtLeast(java.io.Reader input,
java.io.Writer output,
int atLeast)
throws java.io.IOException
java.io.IOExceptionpublic static void copy(java.io.Reader input,
java.io.Writer output,
int bufferSize)
throws java.io.IOException
java.io.IOExceptionpublic static void transferTo(java.io.InputStream inputStream,
java.io.File destinationFile)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String toString(java.io.InputStream input)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String toString(java.io.InputStream input,
java.lang.String charset)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String toString(java.io.InputStream input,
int bufferSize)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String toString(java.io.InputStream input,
int bufferSize,
java.lang.String charset)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String toString(java.io.Reader input)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String toString(java.io.Reader input,
int bufSize)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String readStringFromStream(java.io.InputStream in)
throws java.io.IOException
java.io.IOExceptionpublic static java.io.ByteArrayInputStream loadIntoBAIS(java.io.InputStream in)
throws java.io.IOException
in - java.io.IOExceptionpublic static void consume(java.io.InputStream in)
throws java.io.IOException
java.io.IOExceptionpublic static void consume(java.io.InputStream input,
int atLeast)
throws java.io.IOException
input - atLeast - java.io.IOExceptionpublic static byte[] readBytesFromStream(java.io.InputStream in)
throws java.io.IOException
java.io.IOException