Class StreamUtil


  • public final class StreamUtil
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void copy​(java.io.InputStream inputStream, java.io.OutputStream outputStream)
      copies all data from the input stream to the output stream.
      static boolean toFile​(java.io.InputStream inputStream, java.io.File destinationFile)
      ensures, that the given input stream is extracted to the given file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • copy

        public static void copy​(java.io.InputStream inputStream,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        copies all data from the input stream to the output stream. The output stream is flushed afterwards. None of the streams is opened or closed.
        Parameters:
        inputStream - the stream from which to copy the data
        outputStream - the stream to copy the data to
        Throws:
        java.io.IOException - if something goes wrong.
      • toFile

        public static final boolean toFile​(java.io.InputStream inputStream,
                                           java.io.File destinationFile)
        ensures, that the given input stream is extracted to the given file. If the file already exists it is overwritten!
        Parameters:
        inputStream - the stream from which to read
        destinationFile - the file where the resource shall be extracted to
        Returns:
        true if successful, false if not