Class IOUtil

java.lang.Object
org.apache.kerby.util.IOUtil

public final class IOUtil extends Object
Some IO and file related utilities.
  • Method Details

    • readInputStream

      public static byte[] readInputStream(InputStream in) throws IOException
      Throws:
      IOException
    • readInputStream

      public static void readInputStream(InputStream in, byte[] buf) throws IOException
      Throws:
      IOException
    • readInput

      public static String readInput(InputStream in) throws IOException
      Read an input stream and return the content as string assuming UTF8.
      Parameters:
      in - The input stream
      Returns:
      The read String
      Throws:
      IOException - e
    • readFile

      public static String readFile(File file) throws IOException
      Read a file and return the content as string assuming UTF8.
      Parameters:
      file - The file to read
      Returns:
      The content as a UTF-8 String
      Throws:
      IOException - If an error occurred
    • writeFile

      public static void writeFile(String content, File file) throws IOException
      Write a file with the content assuming UTF8.
      Parameters:
      content - The content
      file - The file to write
      Throws:
      IOException - e