public final class IO
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
IO.SafeFileFilter
A
FileFilter for obtaining a list of contents that does not contain the special
. and .. entries that some JVM environments report. |
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE |
Modifier | Constructor and Description |
---|---|
private |
IO() |
Modifier and Type | Method and Description |
---|---|
static void |
close(java.io.Closeable c)
closes an
Closeable , and silently ignores exceptions |
static 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 entire
InputStream to the OutputStream |
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 another
|
static java.lang.String |
readToString(java.io.File file)
Read the contents of a file into a String and return it.
|
public static final int BUFFER_SIZE
public static void copy(java.io.Reader in, java.io.Writer out) throws java.io.IOException
in
- the Reader to read fromout
- the Writer to write tojava.io.IOException
- if unable to copy the contentspublic static java.lang.String readToString(java.io.File file) throws java.io.IOException
file
- the file to read.java.io.IOException
- if unable to read the file.public static void close(java.io.Closeable c)
Closeable
, and silently ignores exceptionsc
- the closeable to closepublic static void copy(java.io.File from, java.io.File to) throws java.io.IOException
from
- the from pathto
- the destination pathjava.io.IOException
- if unable to copy the filepublic static void copyDir(java.io.File from, java.io.File to) throws java.io.IOException
from
- the from directoryto
- the destination directoryjava.io.IOException
- if unable to copy the filepublic static void copy(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
InputStream
to the OutputStream
in
- the input stream to read fromout
- the output stream to write tojava.io.IOException
- if unable to copy the streampublic static void copyFile(java.io.File from, java.io.File to) throws java.io.IOException
from
- the file to copyto
- the destination file to createjava.io.IOException
- if unable to copy the file