public final class IOUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFER_SIZE |
static Charset |
UTF8_CHARSET |
Modifier and Type | Method and Description |
---|---|
static void |
consume(InputStream in) |
static void |
consume(InputStream input,
int atLeast)
Consumes at least the given number of bytes from the input stream
|
static int |
copy(InputStream input,
OutputStream output) |
static int |
copy(InputStream input,
OutputStream output,
int bufferSize) |
static void |
copy(Reader input,
Writer output,
int bufferSize) |
static int |
copyAndCloseInput(InputStream input,
OutputStream output) |
static int |
copyAndCloseInput(InputStream input,
OutputStream output,
int bufferSize) |
static void |
copyAndCloseInput(Reader input,
Writer output) |
static void |
copyAndCloseInput(Reader input,
Writer output,
int bufferSize) |
static void |
copyAtLeast(InputStream input,
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(Reader input,
Writer output,
int atLeast) |
static boolean |
isEmpty(InputStream is) |
static ByteArrayInputStream |
loadIntoBAIS(InputStream in)
Load the InputStream into memory and return a ByteArrayInputStream that
represents it.
|
static String |
newStringFromBytes(byte[] bytes)
Use this function instead of new String(byte[]) to avoid surprises from non-standard default encodings.
|
static 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 String |
newStringFromBytes(byte[] bytes,
String charsetName)
Use this function instead of new String(byte[], String) to avoid surprises from
non-standard default encodings.
|
static String |
newStringFromBytes(byte[] bytes,
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(InputStream in) |
static String |
readStringFromStream(InputStream in) |
static String |
toString(InputStream input) |
static String |
toString(InputStream input,
int bufferSize) |
static String |
toString(InputStream input,
int bufferSize,
String charset) |
static String |
toString(InputStream input,
String charset) |
static String |
toString(Reader input) |
static String |
toString(Reader input,
int bufSize) |
static void |
transferTo(InputStream inputStream,
File destinationFile) |
public static final Charset UTF8_CHARSET
public static final int DEFAULT_BUFFER_SIZE
public static boolean isEmpty(InputStream is) throws IOException
IOException
public static String newStringFromBytes(byte[] bytes, String charsetName)
bytes
- charsetName
- public static String newStringFromBytes(byte[] bytes)
bytes
- public static String newStringFromBytes(byte[] bytes, String charsetName, int start, int length)
bytes
- charsetName
- start
- length
- public static String newStringFromBytes(byte[] bytes, int start, int length)
bytes
- start
- length
- public static int copy(InputStream input, OutputStream output) throws IOException
IOException
public static int copyAndCloseInput(InputStream input, OutputStream output) throws IOException
IOException
public static int copyAndCloseInput(InputStream input, OutputStream output, int bufferSize) throws IOException
IOException
public static void copyAndCloseInput(Reader input, Writer output) throws IOException
IOException
public static void copyAndCloseInput(Reader input, Writer output, int bufferSize) throws IOException
IOException
public static int copy(InputStream input, OutputStream output, int bufferSize) throws IOException
IOException
public static void copyAtLeast(InputStream input, OutputStream output, int atLeast) throws IOException
input
- output
- atLeast
- IOException
public static void copyAtLeast(Reader input, Writer output, int atLeast) throws IOException
IOException
public static void copy(Reader input, Writer output, int bufferSize) throws IOException
IOException
public static void transferTo(InputStream inputStream, File destinationFile) throws IOException
IOException
public static String toString(InputStream input) throws IOException
IOException
public static String toString(InputStream input, String charset) throws IOException
IOException
public static String toString(InputStream input, int bufferSize) throws IOException
IOException
public static String toString(InputStream input, int bufferSize, String charset) throws IOException
IOException
public static String toString(Reader input) throws IOException
IOException
public static String toString(Reader input, int bufSize) throws IOException
IOException
public static String readStringFromStream(InputStream in) throws IOException
IOException
public static ByteArrayInputStream loadIntoBAIS(InputStream in) throws IOException
in
- IOException
public static void consume(InputStream in) throws IOException
IOException
public static void consume(InputStream input, int atLeast) throws IOException
input
- atLeast
- IOException
public static byte[] readBytesFromStream(InputStream in) throws IOException
IOException
Copyright © 2017 JBoss by Red Hat. All rights reserved.