Class StreamHelper


  • public class StreamHelper
    extends Object
    Stream helper class
    • Constructor Detail

      • StreamHelper

        public StreamHelper()
    • Method Detail

      • copyTo

        public static void copyTo​(InputStream source,
                                  OutputStream destination)
                           throws IOException
        Copies content of one stream to another.
        Parameters:
        source - The source.
        destination - The destination.
        Throws:
        IOException
      • copyTo

        public static void copyTo​(InputStream source,
                                  OutputStream destination,
                                  int bufferSize)
                           throws IOException
        Copies content of one stream to another.
        Parameters:
        source - The source.
        destination - The destination.
        bufferSize - Size of the buffer.
        Throws:
        IOException
      • readAsBytes

        public static byte[] readAsBytes​(InputStream input)
                                  throws IOException
        Reads stream content as bytes.
        Parameters:
        input - The input.
        Returns:
        Stream content as bytes.
        Throws:
        IOException
      • toString

        public static String toString​(InputStream input)
                               throws IOException
        Reads stream content as string.
        Parameters:
        input - The input.
        Returns:
        Stream content as string.
        Throws:
        IOException