Package org.eclipse.jetty.toolchain.test
Class IO
- java.lang.Object
-
- org.eclipse.jetty.toolchain.test.IO
-
public final class IO extends java.lang.Object
IO Utilities.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IO.SafeFileFilter
AFileFilter
for obtaining a list of contents that does not contain the special.
and..
entries that some JVM environments report.
-
Field Summary
Fields Modifier and Type Field Description static int
BUFFER_SIZE
-
Constructor Summary
Constructors Modifier Constructor Description private
IO()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
close(java.io.Closeable c)
closes anCloseable
, and silently ignores exceptionsstatic void
copy(java.io.File from, java.io.File to)
Copy files or directories.static void
copy(java.io.InputStream in, java.io.OutputStream out)
Copy the entireInputStream
to theOutputStream
static void
copy(java.io.Reader in, java.io.Writer out)
Copy Reader to Writer out until EOF or exception.static void
copyDir(java.io.File from, java.io.File to)
Copy the contents of a directory from one directory to another.static void
copyFile(java.io.File from, java.io.File to)
Copy a file from one place to anotherstatic java.lang.String
readToString(java.io.File file)
Read the contents of a file into a String and return it.
-
-
-
Field Detail
-
BUFFER_SIZE
public static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
copy
public static void copy(java.io.Reader in, java.io.Writer out) throws java.io.IOException
Copy Reader to Writer out until EOF or exception.- Parameters:
in
- the Reader to read fromout
- the Writer to write to- Throws:
java.io.IOException
- if unable to copy the contents
-
readToString
public static java.lang.String readToString(java.io.File file) throws java.io.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:
java.io.IOException
- if unable to read the file.
-
close
public static void close(java.io.Closeable c)
closes anCloseable
, and silently ignores exceptions- Parameters:
c
- the closeable to close
-
copy
public static void copy(java.io.File from, java.io.File to) throws java.io.IOException
Copy files or directories.- Parameters:
from
- the from pathto
- the destination path- Throws:
java.io.IOException
- if unable to copy the file
-
copyDir
public static void copyDir(java.io.File from, java.io.File to) throws java.io.IOException
Copy the contents of a directory from one directory to another.- Parameters:
from
- the from directoryto
- the destination directory- Throws:
java.io.IOException
- if unable to copy the file
-
copy
public static void copy(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
Copy the entireInputStream
to theOutputStream
- Parameters:
in
- the input stream to read fromout
- the output stream to write to- Throws:
java.io.IOException
- if unable to copy the stream
-
copyFile
public static void copyFile(java.io.File from, java.io.File to) throws java.io.IOException
Copy a file from one place to another- Parameters:
from
- the file to copyto
- the destination file to create- Throws:
java.io.IOException
- if unable to copy the file
-
-