public final class IO extends 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 and Type | Method and Description |
---|---|
static void |
close(Closeable c)
closes an
Closeable , and silently ignores exceptions |
static void |
copy(File from,
File to)
Copy files or directories.
|
static void |
copy(InputStream in,
OutputStream out)
Copy the entire
InputStream to the OutputStream |
static void |
copy(Reader in,
Writer out)
Copy Reader to Writer out until EOF or exception.
|
static void |
copyDir(File from,
File to)
Copy the contents of a directory from one directory to another.
|
static void |
copyFile(File from,
File to)
Copy a file from one place to another
|
static String |
readToString(File file)
Read the contents of a file into a String and return it.
|
public static final int BUFFER_SIZE
public static void copy(Reader in, Writer out) throws IOException
in
- the Reader to read fromout
- the Writer to write toIOException
- if unable to copy the contentspublic static String readToString(File file) throws IOException
file
- the file to read.IOException
- if unable to read the file.public static void close(Closeable c)
Closeable
, and silently ignores exceptionsc
- the closeable to closepublic static void copy(File from, File to) throws IOException
from
- the from pathto
- the destination pathIOException
- if unable to copy the filepublic static void copyDir(File from, File to) throws IOException
from
- the from directoryto
- the destination directoryIOException
- if unable to copy the filepublic static void copy(InputStream in, OutputStream out) throws IOException
InputStream
to the OutputStream
in
- the input stream to read fromout
- the output stream to write toIOException
- if unable to copy the streampublic static void copyFile(File from, File to) throws IOException
from
- the file to copyto
- the destination file to createIOException
- if unable to copy the fileCopyright © 1995–2024 Mort Bay Consulting. All rights reserved.