Class StreamUtils

java.lang.Object
net.sourceforge.jnlp.util.StreamUtils

public class StreamUtils extends Object
  • Constructor Details

    • StreamUtils

      public StreamUtils()
  • Method Details

    • closeSilently

      public static void closeSilently(Closeable stream)
      Closes a stream, without throwing IOException. In IOException is properly logged and consumed
      Parameters:
      stream - the stream that will be closed
    • copyStream

      public static void copyStream(InputStream input, OutputStream output) throws IOException
      Copy an input stream's contents into an output stream.
      Parameters:
      input - input stream
      output - stream where to copy input
      Throws:
      IOException - if IO fails
    • readStreamAsString

      public static String readStreamAsString(InputStream stream) throws IOException
      Throws:
      IOException
    • readStreamAsString

      public static String readStreamAsString(InputStream stream, String encoding) throws IOException
      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

      public static void waitForSafely(Process p)
      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