public class IO extends Object
Modifier and Type | Field and Description |
---|---|
static File |
home |
static OutputStream |
nullStream |
static Writer |
nullWriter |
static File |
work |
Constructor and Description |
---|
IO() |
Modifier and Type | Method and Description |
---|---|
static Throwable |
close(Closeable in) |
static String |
collect(File a) |
static String |
collect(File a,
String encoding) |
static String |
collect(InputStream a) |
static String |
collect(InputStream a,
String encoding) |
static String |
collect(Reader a) |
static String |
collect(String a) |
static String |
collect(URL a) |
static String |
collect(URL a,
String encoding) |
static void |
copy(byte[] data,
File file) |
static void |
copy(byte[] r,
OutputStream w) |
static void |
copy(byte[] r,
Writer w) |
void |
copy(Collection<?> c,
OutputStream out) |
static void |
copy(File a,
File b) |
static void |
copy(File in,
MessageDigest md) |
static void |
copy(File a,
OutputStream b) |
static void |
copy(InputStream in,
ByteBuffer bb) |
static void |
copy(InputStream in,
DataOutput out) |
static void |
copy(InputStream a,
File b) |
static void |
copy(InputStream in,
MessageDigest md) |
static void |
copy(InputStream in,
OutputStream out) |
static void |
copy(InputStream in,
URL out) |
static void |
copy(InputStream in,
URL out,
String method) |
static void |
copy(InputStream r,
Writer w) |
static void |
copy(InputStream r,
Writer w,
String charset) |
static void |
copy(Reader r,
OutputStream o) |
static void |
copy(Reader r,
OutputStream o,
String charset) |
static void |
copy(Reader r,
Writer w) |
static void |
copy(URLConnection c,
File file) |
static void |
copy(URLConnection in,
MessageDigest md) |
static void |
copy(URL url,
File file) |
static void |
copy(URL in,
MessageDigest md) |
static boolean |
createSymbolicLink(File link,
File target)
Reflective way to create a link.
|
static File |
createTempFile(File directory,
String pattern,
String suffix)
Create a temporary file.
|
static void |
delete(File f)
Deletes the specified file.
|
static void |
deleteWithException(File f)
Deletes the specified file.
|
static long |
drain(InputStream in) |
static String |
getExtension(String fileName,
String deflt) |
static File |
getFile(File base,
String file) |
static File |
getFile(String filename) |
static void |
initialize(File f)
Deletes and creates directories
|
static boolean |
isSymbolicLink(File link) |
static byte[] |
read(File f) |
static byte[] |
read(InputStream in) |
static byte[] |
read(URL u) |
static BufferedReader |
reader(File f) |
static BufferedReader |
reader(File f,
String encoding) |
static BufferedReader |
reader(InputStream in) |
static BufferedReader |
reader(InputStream in,
String encoding) |
static Reader |
reader(String s) |
static void |
rename(File from,
File to)
Deletes
to file if it exists, and renames from
file to to .Throws exception the rename operation fails. |
static void |
store(Object o,
File out) |
static void |
store(Object o,
File out,
String encoding) |
static void |
store(Object o,
OutputStream fout) |
static void |
store(Object o,
OutputStream fout,
String encoding) |
static InputStream |
stream(File s) |
static InputStream |
stream(String s) |
static InputStream |
stream(String s,
String encoding) |
static InputStream |
stream(URL s) |
static String |
toSafeFileName(String string) |
static URL |
toURL(String s,
File base) |
static Collection<File> |
tree(File current) |
static Collection<File> |
tree(File current,
String glob) |
static void |
write(byte[] data,
File out) |
static void |
write(byte[] data,
OutputStream out) |
static PrintWriter |
writer(File f) |
static PrintWriter |
writer(File f,
String encoding) |
static PrintWriter |
writer(OutputStream out) |
static PrintWriter |
writer(OutputStream out,
String encoding) |
public static final File work
public static final File home
public static OutputStream nullStream
public static Writer nullWriter
public static Collection<File> tree(File current)
public static Collection<File> tree(File current, String glob)
public static void copy(Reader r, Writer w) throws IOException
IOException
public static void copy(InputStream r, Writer w) throws IOException
IOException
public static void copy(byte[] r, Writer w) throws IOException
IOException
public static void copy(byte[] data, File file) throws FileNotFoundException, IOException
FileNotFoundException
IOException
public static void copy(byte[] r, OutputStream w) throws IOException
IOException
public static void copy(InputStream r, Writer w, String charset) throws IOException
IOException
public static void copy(Reader r, OutputStream o) throws IOException
IOException
public static void copy(Reader r, OutputStream o, String charset) throws IOException
IOException
public static void copy(InputStream in, OutputStream out) throws IOException
IOException
public static void copy(InputStream in, DataOutput out) throws IOException
IOException
public static void copy(InputStream in, ByteBuffer bb) throws IOException
IOException
public static void copy(URL in, MessageDigest md) throws IOException
IOException
public static void copy(File in, MessageDigest md) throws IOException
IOException
public static void copy(URLConnection in, MessageDigest md) throws IOException
IOException
public static void copy(InputStream in, MessageDigest md) throws IOException
IOException
public static void copy(URL url, File file) throws IOException
IOException
public static void copy(URLConnection c, File file) throws IOException
IOException
public static void copy(InputStream in, URL out) throws IOException
IOException
public static void copy(InputStream in, URL out, String method) throws IOException
IOException
public static void copy(File a, File b) throws IOException
IOException
public static void copy(InputStream a, File b) throws IOException
IOException
public static void copy(File a, OutputStream b) throws IOException
IOException
public static byte[] read(File f) throws IOException
IOException
public static byte[] read(URL u) throws IOException
IOException
public static byte[] read(InputStream in) throws IOException
IOException
public static void write(byte[] data, OutputStream out) throws Exception
Exception
public static String collect(File a, String encoding) throws IOException
IOException
public static String collect(URL a, String encoding) throws IOException
IOException
public static String collect(URL a) throws IOException
IOException
public static String collect(File a) throws IOException
IOException
public static String collect(String a) throws IOException
IOException
public static String collect(InputStream a, String encoding) throws IOException
IOException
public static String collect(InputStream a) throws IOException
IOException
public static String collect(Reader a) throws IOException
IOException
public static File createTempFile(File directory, String pattern, String suffix) throws IllegalArgumentException, 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 usedIllegalArgumentException
- when pattern is null or too shortIOException
- when the specified (non-null) directory is not a
directorypublic static void delete(File f)
f
- file to be deletedpublic static void initialize(File f)
public static void deleteWithException(File f) throws IOException
f
- file to be deletedIOException
- if the file (or contents of a folder) could not be
deletedpublic static void rename(File from, File to) throws IOException
to
file if it exists, and renames from
file to to
.from
- source fileto
- destination fileIOException
- if the rename operation failspublic static long drain(InputStream in) throws IOException
IOException
public void copy(Collection<?> c, OutputStream out) throws IOException
IOException
public static URL toURL(String s, File base) throws MalformedURLException
MalformedURLException
public static void store(Object o, File out) throws IOException
IOException
public static void store(Object o, File out, String encoding) throws IOException
IOException
public static void store(Object o, OutputStream fout) throws IOException
IOException
public static void store(Object o, OutputStream fout, String encoding) throws IOException
IOException
public static InputStream stream(String s)
public static InputStream stream(String s, String encoding) throws UnsupportedEncodingException
UnsupportedEncodingException
public static InputStream stream(File s) throws FileNotFoundException
FileNotFoundException
public static InputStream stream(URL s) throws IOException
IOException
public static BufferedReader reader(File f, String encoding) throws IOException
IOException
public static BufferedReader reader(File f) throws IOException
IOException
public static PrintWriter writer(File f, String encoding) throws IOException
IOException
public static PrintWriter writer(File f) throws IOException
IOException
public static PrintWriter writer(OutputStream out, String encoding) throws IOException
IOException
public static BufferedReader reader(InputStream in, String encoding) throws IOException
IOException
public static BufferedReader reader(InputStream in) throws IOException
IOException
public static PrintWriter writer(OutputStream out) throws IOException
IOException
public static boolean createSymbolicLink(File link, File target) throws Exception
Exception
public static boolean isSymbolicLink(File link)
Copyright © 2017 aQute SARL. All rights reserved.