Package org.eclipse.jetty.toolchain.test
Class IO
- java.lang.Object
-
- org.eclipse.jetty.toolchain.test.IO
-
public final class IO extends java.lang.ObjectIO Utilities.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIO.SafeFileFilterAFileFilterfor 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 intBUFFER_SIZE
-
Constructor Summary
Constructors Modifier Constructor Description privateIO()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclose(java.io.Closeable c)closes anCloseable, and silently ignores exceptionsstatic voidcopy(java.io.File from, java.io.File to)Copy files or directories.static voidcopy(java.io.InputStream in, java.io.OutputStream out)Copy the entireInputStreamto theOutputStreamstatic voidcopy(java.io.Reader in, java.io.Writer out)Copy Reader to Writer out until EOF or exception.static voidcopyDir(java.io.File from, java.io.File to)Copy the contents of a directory from one directory to another.static voidcopyFile(java.io.File from, java.io.File to)Copy a file from one place to anotherstatic java.lang.StringreadToString(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.IOExceptionCopy 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.IOExceptionRead 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.IOExceptionCopy 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.IOExceptionCopy 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.IOExceptionCopy the entireInputStreamto 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.IOExceptionCopy 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
-
-