public class IO
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static int |
BUFFER_SIZE |
static java.io.File |
home |
static java.io.OutputStream |
nullStream |
static java.io.Writer |
nullWriter |
(package private) static java.util.regex.Pattern |
RESERVED_WINDOWS_P |
static java.io.File |
work |
Constructor and Description |
---|
IO() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Throwable |
close(java.io.Closeable in) |
static java.lang.String |
collect(java.io.File a) |
static java.lang.String |
collect(java.io.File a,
java.lang.String encoding) |
static java.lang.String |
collect(java.io.InputStream a) |
static java.lang.String |
collect(java.io.InputStream a,
java.lang.String encoding) |
static java.lang.String |
collect(java.io.Reader a) |
static java.lang.String |
collect(java.lang.String a) |
static java.lang.String |
collect(java.net.URL a) |
static java.lang.String |
collect(java.net.URL a,
java.lang.String encoding) |
static void |
copy(byte[] data,
java.io.File file) |
static void |
copy(byte[] r,
java.io.OutputStream w) |
static void |
copy(byte[] r,
java.io.Writer w) |
void |
copy(java.util.Collection<?> c,
java.io.OutputStream out) |
static void |
copy(java.io.File a,
java.io.File b) |
static void |
copy(java.io.File in,
java.security.MessageDigest md) |
static void |
copy(java.io.File a,
java.io.OutputStream b) |
static void |
copy(java.io.InputStream in,
java.nio.ByteBuffer bb) |
static void |
copy(java.io.InputStream in,
java.io.DataOutput out) |
static void |
copy(java.io.InputStream a,
java.io.File b) |
static void |
copy(java.io.InputStream in,
java.security.MessageDigest md) |
static void |
copy(java.io.InputStream in,
java.io.OutputStream out) |
static void |
copy(java.io.InputStream in,
java.net.URL out) |
static void |
copy(java.io.InputStream in,
java.net.URL out,
java.lang.String method) |
static void |
copy(java.io.InputStream r,
java.io.Writer w) |
static void |
copy(java.io.InputStream r,
java.io.Writer w,
java.lang.String charset) |
static void |
copy(java.io.Reader r,
java.io.OutputStream o) |
static void |
copy(java.io.Reader r,
java.io.OutputStream o,
java.lang.String charset) |
static void |
copy(java.io.Reader r,
java.io.Writer w) |
static void |
copy(java.net.URLConnection c,
java.io.File file) |
static void |
copy(java.net.URLConnection in,
java.security.MessageDigest md) |
static void |
copy(java.net.URL url,
java.io.File file) |
static void |
copy(java.net.URL in,
java.security.MessageDigest md) |
static boolean |
createSymbolicLink(java.io.File link,
java.io.File target)
Reflective way to create a link.
|
static java.io.File |
createTempFile(java.io.File directory,
java.lang.String pattern,
java.lang.String suffix)
Create a temporary file.
|
static void |
delete(java.io.File f)
Deletes the specified file.
|
static void |
deleteWithException(java.io.File f)
Deletes the specified file.
|
static long |
drain(java.io.InputStream in) |
static java.lang.String |
getExtension(java.lang.String fileName,
java.lang.String deflt) |
static java.io.File |
getFile(java.io.File base,
java.lang.String file) |
static java.io.File |
getFile(java.lang.String filename) |
static void |
initialize(java.io.File f)
Deletes and creates directories
|
static boolean |
isSymbolicLink(java.io.File link) |
(package private) static boolean |
isWindows() |
static byte[] |
read(java.io.File f) |
static byte[] |
read(java.io.InputStream in) |
static byte[] |
read(java.net.URL u) |
static java.io.BufferedReader |
reader(java.io.File f) |
static java.io.BufferedReader |
reader(java.io.File f,
java.lang.String encoding) |
static java.io.BufferedReader |
reader(java.io.InputStream in) |
static java.io.BufferedReader |
reader(java.io.InputStream in,
java.lang.String encoding) |
static java.io.Reader |
reader(java.lang.String s) |
static void |
rename(java.io.File from,
java.io.File to)
Deletes
to file if it exists, and renames from
file to to .Throws exception the rename operation fails. |
static void |
store(java.lang.Object o,
java.io.File out) |
static void |
store(java.lang.Object o,
java.io.File out,
java.lang.String encoding) |
static void |
store(java.lang.Object o,
java.io.OutputStream fout) |
static void |
store(java.lang.Object o,
java.io.OutputStream fout,
java.lang.String encoding) |
static java.io.InputStream |
stream(java.io.File s) |
static java.io.InputStream |
stream(java.lang.String s) |
static java.io.InputStream |
stream(java.lang.String s,
java.lang.String encoding) |
static java.io.InputStream |
stream(java.net.URL s) |
static java.lang.String |
toSafeFileName(java.lang.String string) |
static java.net.URL |
toURL(java.lang.String s,
java.io.File base) |
private static void |
traverse(java.util.Collection<java.io.File> files,
java.io.File current,
Glob glob) |
static java.util.Collection<java.io.File> |
tree(java.io.File current) |
static java.util.Collection<java.io.File> |
tree(java.io.File current,
java.lang.String glob) |
static void |
write(byte[] data,
java.io.File out) |
static void |
write(byte[] data,
java.io.OutputStream out) |
static java.io.PrintWriter |
writer(java.io.File f) |
static java.io.PrintWriter |
writer(java.io.File f,
java.lang.String encoding) |
static java.io.PrintWriter |
writer(java.io.OutputStream out) |
static java.io.PrintWriter |
writer(java.io.OutputStream out,
java.lang.String encoding) |
static final int BUFFER_SIZE
public static final java.io.File work
public static final java.io.File home
public static java.io.OutputStream nullStream
public static java.io.Writer nullWriter
static final java.util.regex.Pattern RESERVED_WINDOWS_P
public static java.lang.String getExtension(java.lang.String fileName, java.lang.String deflt)
public static java.util.Collection<java.io.File> tree(java.io.File current)
public static java.util.Collection<java.io.File> tree(java.io.File current, java.lang.String glob)
private static void traverse(java.util.Collection<java.io.File> files, java.io.File current, Glob glob)
public static void copy(java.io.Reader r, java.io.Writer w) throws java.io.IOException
java.io.IOException
public static void copy(java.io.InputStream r, java.io.Writer w) throws java.io.IOException
java.io.IOException
public static void copy(byte[] r, java.io.Writer w) throws java.io.IOException
java.io.IOException
public static void copy(byte[] data, java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
java.io.IOException
public static void copy(byte[] r, java.io.OutputStream w) throws java.io.IOException
java.io.IOException
public static void copy(java.io.InputStream r, java.io.Writer w, java.lang.String charset) throws java.io.IOException
java.io.IOException
public static void copy(java.io.Reader r, java.io.OutputStream o) throws java.io.IOException
java.io.IOException
public static void copy(java.io.Reader r, java.io.OutputStream o, java.lang.String charset) throws java.io.IOException
java.io.IOException
public static void copy(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public static void copy(java.io.InputStream in, java.io.DataOutput out) throws java.io.IOException
java.io.IOException
public static void copy(java.io.InputStream in, java.nio.ByteBuffer bb) throws java.io.IOException
java.io.IOException
public static void copy(java.net.URL in, java.security.MessageDigest md) throws java.io.IOException
java.io.IOException
public static void copy(java.io.File in, java.security.MessageDigest md) throws java.io.IOException
java.io.IOException
public static void copy(java.net.URLConnection in, java.security.MessageDigest md) throws java.io.IOException
java.io.IOException
public static void copy(java.io.InputStream in, java.security.MessageDigest md) throws java.io.IOException
java.io.IOException
public static void copy(java.net.URL url, java.io.File file) throws java.io.IOException
java.io.IOException
public static void copy(java.net.URLConnection c, java.io.File file) throws java.io.IOException
java.io.IOException
public static void copy(java.io.InputStream in, java.net.URL out) throws java.io.IOException
java.io.IOException
public static void copy(java.io.InputStream in, java.net.URL out, java.lang.String method) throws java.io.IOException
java.io.IOException
public static void copy(java.io.File a, java.io.File b) throws java.io.IOException
java.io.IOException
public static void copy(java.io.InputStream a, java.io.File b) throws java.io.IOException
java.io.IOException
public static void copy(java.io.File a, java.io.OutputStream b) throws java.io.IOException
java.io.IOException
public static byte[] read(java.io.File f) throws java.io.IOException
java.io.IOException
public static byte[] read(java.net.URL u) throws java.io.IOException
java.io.IOException
public static byte[] read(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public static void write(byte[] data, java.io.OutputStream out) throws java.lang.Exception
java.lang.Exception
public static void write(byte[] data, java.io.File out) throws java.lang.Exception
java.lang.Exception
public static java.lang.String collect(java.io.File a, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static java.lang.String collect(java.net.URL a, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static java.lang.String collect(java.net.URL a) throws java.io.IOException
java.io.IOException
public static java.lang.String collect(java.io.File a) throws java.io.IOException
java.io.IOException
public static java.lang.String collect(java.lang.String a) throws java.io.IOException
java.io.IOException
public static java.lang.String collect(java.io.InputStream a, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static java.lang.String collect(java.io.InputStream a) throws java.io.IOException
java.io.IOException
public static java.lang.String collect(java.io.Reader a) throws java.io.IOException
java.io.IOException
public static java.io.File createTempFile(java.io.File directory, java.lang.String pattern, java.lang.String suffix) throws java.lang.IllegalArgumentException, java.io.IOException
directory
- the directory in which to create the file. Can be null,
in which case the system TMP directory is usedpattern
- the filename prefix pattern. Must be at least 3 characters
longsuffix
- the filename suffix. Can be null, in which case (system)
default suffix is usedjava.lang.IllegalArgumentException
- when pattern is null or too shortjava.io.IOException
- when the specified (non-null) directory is not a
directorypublic static java.io.File getFile(java.lang.String filename)
public static java.io.File getFile(java.io.File base, java.lang.String file)
public static void delete(java.io.File f)
f
- file to be deletedpublic static void initialize(java.io.File f)
public static void deleteWithException(java.io.File f) throws java.io.IOException
f
- file to be deletedjava.io.IOException
- if the file (or contents of a folder) could not be
deletedpublic static void rename(java.io.File from, java.io.File to) throws java.io.IOException
to
file if it exists, and renames from
file to to
.from
- source fileto
- destination filejava.io.IOException
- if the rename operation failspublic static long drain(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public void copy(java.util.Collection<?> c, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public static java.lang.Throwable close(java.io.Closeable in)
public static java.net.URL toURL(java.lang.String s, java.io.File base) throws java.net.MalformedURLException
java.net.MalformedURLException
public static void store(java.lang.Object o, java.io.File out) throws java.io.IOException
java.io.IOException
public static void store(java.lang.Object o, java.io.File out, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static void store(java.lang.Object o, java.io.OutputStream fout) throws java.io.IOException
java.io.IOException
public static void store(java.lang.Object o, java.io.OutputStream fout, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static java.io.InputStream stream(java.lang.String s)
public static java.io.InputStream stream(java.lang.String s, java.lang.String encoding) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static java.io.InputStream stream(java.io.File s) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public static java.io.InputStream stream(java.net.URL s) throws java.io.IOException
java.io.IOException
public static java.io.Reader reader(java.lang.String s)
public static java.io.BufferedReader reader(java.io.File f, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static java.io.BufferedReader reader(java.io.File f) throws java.io.IOException
java.io.IOException
public static java.io.PrintWriter writer(java.io.File f, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static java.io.PrintWriter writer(java.io.File f) throws java.io.IOException
java.io.IOException
public static java.io.PrintWriter writer(java.io.OutputStream out, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static java.io.BufferedReader reader(java.io.InputStream in, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static java.io.BufferedReader reader(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public static java.io.PrintWriter writer(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public static boolean createSymbolicLink(java.io.File link, java.io.File target) throws java.lang.Exception
java.lang.Exception
public static boolean isSymbolicLink(java.io.File link)
public static java.lang.String toSafeFileName(java.lang.String string)
static boolean isWindows()