Class InputStreamHelper


  • public abstract class InputStreamHelper
    extends Object
    A set of static utility methods for InputStream.
    • Method Detail

      • readAllBytes

        public static byte[] readAllBytes​(InputStream is)
                                   throws IOException
        Reads all remaining bytes from the input stream.This method blocks until all remaining bytes have been read and end of stream is detected, or an exception is thrown.
        Parameters:
        is - the InputStream to use
        Returns:
        a byte array containing the bytes read from this input stream
        Throws:
        IOException - if an I/O error occurs
        OutOfMemoryError - if an array of the required size cannot be allocated. For example, if an array larger than 2GB would be required to store the bytes.