java.lang.Object
org.eclipse.jetty.toolchain.test.IO

public final class IO extends Object
IO Utilities.
  • Field Details

  • Constructor Details

    • IO

      private IO()
  • Method Details

    • copy

      public static void copy(Reader in, Writer out) throws IOException
      Copy Reader to Writer out until EOF or exception.
      Parameters:
      in - the Reader to read from
      out - the Writer to write to
      Throws:
      IOException - if unable to copy the contents
    • readToString

      public static String readToString(File file) throws IOException
      Read the contents of a file into a String and return it.
      Parameters:
      file - the file to read.
      Returns:
      the contents of the file.
      Throws:
      IOException - if unable to read the file.
    • close

      public static void close(Closeable c)
      closes an Closeable, and silently ignores exceptions
      Parameters:
      c - the closeable to close
    • copy

      public static void copy(File from, File to) throws IOException
      Copy files or directories.
      Parameters:
      from - the from path
      to - the destination path
      Throws:
      IOException - if unable to copy the file
    • copyDir

      public static void copyDir(File from, File to) throws IOException
      Copy the contents of a directory from one directory to another.
      Parameters:
      from - the from directory
      to - the destination directory
      Throws:
      IOException - if unable to copy the file
    • copy

      public static void copy(InputStream in, OutputStream out) throws IOException
      Copy the entire InputStream to the OutputStream
      Parameters:
      in - the input stream to read from
      out - the output stream to write to
      Throws:
      IOException - if unable to copy the stream
    • copyFile

      public static void copyFile(File from, File to) throws IOException
      Copy a file from one place to another
      Parameters:
      from - the file to copy
      to - the destination file to create
      Throws:
      IOException - if unable to copy the file