Class StreamUtils


  • public final class StreamUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      StreamUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String readToEnd​(java.io.InputStream stream, java.nio.charset.Charset charset)
      Reads the provided stream until the end and returns a string encoded with the provided charset.
      • Methods inherited from class java.lang.Object

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

      • StreamUtils

        public StreamUtils()
    • Method Detail

      • readToEnd

        public static java.lang.String readToEnd​(java.io.InputStream stream,
                                                 java.nio.charset.Charset charset)
                                          throws java.io.IOException
        Reads the provided stream until the end and returns a string encoded with the provided charset.
        Parameters:
        stream - the stream to read
        charset - the charset to use
        Returns:
        a string with the contents of the input stream
        Throws:
        java.lang.NullPointerException - if stream or charset is null
        java.io.IOException - if an I/O error occurs