public class StreamUtils
extends java.lang.Object
Constructor and Description |
---|
StreamUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
closeSilently(java.io.Closeable stream)
Closes a stream, without throwing IOException.
|
static void |
copyStream(java.io.InputStream input,
java.io.OutputStream output)
Copy an input stream's contents into an output stream.
|
static java.lang.String |
readStreamAsString(java.io.InputStream stream) |
static java.lang.String |
readStreamAsString(java.io.InputStream stream,
boolean includeEndOfLines) |
static java.lang.String |
readStreamAsString(java.io.InputStream stream,
boolean includeEndOfLines,
java.lang.String encoding) |
static java.lang.String |
readStreamAsString(java.io.InputStream stream,
java.lang.String encoding) |
static void |
waitForSafely(java.lang.Process p)
This should be workaround for https://en.wikipedia.org/wiki/Spurious_wakeup which real can happen in case of processes.
|
public static void closeSilently(java.io.Closeable stream)
stream
- the stream that will be closedpublic static void copyStream(java.io.InputStream input, java.io.OutputStream output) throws java.io.IOException
input
- input streamoutput
- stream where to copy inputjava.io.IOException
- if IO failspublic static java.lang.String readStreamAsString(java.io.InputStream stream) throws java.io.IOException
java.io.IOException
public static java.lang.String readStreamAsString(java.io.InputStream stream, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static java.lang.String readStreamAsString(java.io.InputStream stream, boolean includeEndOfLines) throws java.io.IOException
java.io.IOException
public static java.lang.String readStreamAsString(java.io.InputStream stream, boolean includeEndOfLines, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static void waitForSafely(java.lang.Process p)
p
- process to be waited for