Package net.sourceforge.jnlp.util
Class StreamUtils
java.lang.Object
net.sourceforge.jnlp.util.StreamUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
closeSilently
(Closeable stream) Closes a stream, without throwing IOException.static void
copyStream
(InputStream input, OutputStream output) Copy an input stream's contents into an output stream.static String
readStreamAsString
(InputStream stream) static String
readStreamAsString
(InputStream stream, boolean includeEndOfLines) static String
readStreamAsString
(InputStream stream, boolean includeEndOfLines, String encoding) static String
readStreamAsString
(InputStream stream, String encoding) static void
This should be workaround for https://en.wikipedia.org/wiki/Spurious_wakeup which real can happen in case of processes.
-
Constructor Details
-
StreamUtils
public StreamUtils()
-
-
Method Details
-
closeSilently
Closes a stream, without throwing IOException. In IOException is properly logged and consumed- Parameters:
stream
- the stream that will be closed
-
copyStream
Copy an input stream's contents into an output stream.- Parameters:
input
- input streamoutput
- stream where to copy input- Throws:
IOException
- if IO fails
-
readStreamAsString
- Throws:
IOException
-
readStreamAsString
- Throws:
IOException
-
readStreamAsString
public static String readStreamAsString(InputStream stream, boolean includeEndOfLines) throws IOException - Throws:
IOException
-
readStreamAsString
public static String readStreamAsString(InputStream stream, boolean includeEndOfLines, String encoding) throws IOException - Throws:
IOException
-
waitForSafely
This should be workaround for https://en.wikipedia.org/wiki/Spurious_wakeup which real can happen in case of processes. See http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2015-June/032350.html thread- Parameters:
p
- process to be waited for
-