Class IOUtils

java.lang.Object
de.iip_ecosphere.platform.support.IOUtils

public class IOUtils extends Object
I/O utilities in the style of org.apache.commons.io.IOUtils.
Author:
Holger Eichelberger, SSE
  • Constructor Details

    • IOUtils

      public IOUtils()
  • Method Details

    • readLines

      public static List<String> readLines(InputStream in) throws IOException
      Gets the contents of an InputStream as a list of Strings, one entry per line, using the Java platform default character encoding.
      Parameters:
      in - the InputStream to read
      Returns:
      the list of Strings
      Throws:
      IOException - if an I/O error occurs
    • readLines

      public static List<String> readLines(InputStream in, Charset charset) throws IOException
      Gets the contents of an InputStream as a list of Strings, one entry per line, using the specified character encoding.
      Parameters:
      in - the InputStream to read
      charset - the charset to use, null means platform default
      Returns:
      the list of Strings
      Throws:
      IOException - if an I/O error occurs
    • toString

      public static String toString(InputStream in) throws IOException
      Gets the contents of an InputStream as a String using the specified Java platform default character encoding.
      Parameters:
      in - the InputStream to read
      Returns:
      the requested String
      Throws:
      IOException - if an I/O error occurs
    • toString

      public static String toString(InputStream in, Charset charset) throws IOException
      Gets the contents of an InputStream as a String using the specified character encoding.
      Parameters:
      in - the InputStream to read
      charset - the charset to use, null means platform default
      Returns:
      the requested String
      Throws:
      IOException - if an I/O error occurs