public class IoUtil extends Object
Constructor and Description |
---|
IoUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
close(AutoCloseable closeable)
Close auto-closeable,
unchecked IOException is thrown for any IO exception,
IllegalStateException for all others.
|
static void |
closeIgnore(AutoCloseable closeable)
Close auto-closeable, ignore any exception.
|
static long |
copy(InputStream input,
OutputStream output) |
static byte[] |
toBytes(InputStream stream)
Get byte array from stream.
|
static byte[] |
toBytes(String string)
Get byte array from string.
|
static InputStream |
toStream(byte[] content) |
static InputStream |
toStream(String content)
Get stream from content.
|
static String |
toString(byte[] bytes)
Get string from byte array.
|
static String |
toString(InputStream stream)
Get string from stream.
|
public static void close(AutoCloseable closeable)
closeable
- the closeablepublic static void closeIgnore(AutoCloseable closeable)
closeable
- the closeablepublic static byte[] toBytes(InputStream stream)
stream
- the streampublic static String toString(InputStream stream)
stream
- the streampublic static String toString(byte[] bytes)
bytes
- the bytespublic static byte[] toBytes(String string)
string
- the stringpublic static InputStream toStream(String content)
content
- the contentpublic static InputStream toStream(byte[] content)
public static long copy(InputStream input, OutputStream output) throws IOException
IOException
Copyright © 2020 Red Hat. All rights reserved.