Class FileReaderUtil


  • public class FileReaderUtil
    extends Object
    Utility class to read the content from an URL or InputStream
    Author:
    dirmeier
    • Method Detail

      • readContent

        public static byte[] readContent​(URL url)
                                  throws IOException
        Reads the content of the given url to a byte array.
        Parameters:
        url - The URL which content should be read
        Returns:
        The byte array that covers the url's content
        Throws:
        IOException - In case of exceptions while reading from the URL
      • readContent

        public static byte[] readContent​(InputStream stream)
                                  throws IOException
        Reads the content of the InputStream to an byte array. The caller is responsible to close the InputStream after calling this method.
        Parameters:
        stream - The stream to read from
        Returns:
        an array of bytes the covers the content of the given InputStream
        Throws:
        IOException - in case of an exception while reading the stream