|
ShrinkWrap Implementation Base 1.0.0-cr-2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.shrinkwrap.impl.base.io.IOUtil
public final class IOUtil
Generic input/output utilities
| Method Summary | ||
|---|---|---|
static byte[] |
asByteArray(InputStream in)
Obtains the contents of the specified stream as a byte array |
|
static String |
asUTF8String(InputStream in)
Obtains the contents of the specified stream as a String in UTF-8 charset. |
|
static void |
bufferedWriteWithFlush(OutputStream output,
byte[] content)
Writing the specified contents to the specified OutputStream using an internal buffer. |
|
static
|
closeOnComplete(S stream,
StreamTask<S> task)
Helper method to run a specified task and automatically handle the closing of the stream. |
|
static
|
closeOnComplete(S stream,
StreamTask<S> task,
StreamErrorHandler errorHandler)
Helper method to run a specified task and automatically handle the closing of the stream. |
|
static void |
copy(InputStream input,
OutputStream output)
Copies the contents from an InputStream to an OutputStream. |
|
static void |
copyWithClose(InputStream input,
OutputStream output)
Copies the contents from an InputStream to an OutputStream and closes both streams. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static byte[] asByteArray(InputStream in)
throws IllegalArgumentException
in -
IllegalArgumentException - If the stream was not specifiedpublic static String asUTF8String(InputStream in)
in -
IllegalArgumentException - If the stream was not specified
public static void copy(InputStream input,
OutputStream output)
throws IOException
OutputStream will be fully flushed.
input - output -
IOException - If a problem occurred during any I/O operations
public static void bufferedWriteWithFlush(OutputStream output,
byte[] content)
throws IOException
output - The OutputStreamcontent - The content to write to the specified stream
IOException - If a problem occured during any I/O operations
public static void copyWithClose(InputStream input,
OutputStream output)
throws IOException
input - output -
IOException - If a problem occurred during any I/O operations during the copy, but on closing the streams these
will be ignored and logged at Level.FINER
public static <S extends Closeable> void closeOnComplete(S stream,
StreamTask<S> task)
stream - task -
public static <S extends Closeable> void closeOnComplete(S stream,
StreamTask<S> task,
StreamErrorHandler errorHandler)
S - task - errorHandler -
|
ShrinkWrap Implementation Base 1.0.0-cr-2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||