org.eclipse.net4j.util.io
Class IOUtil
java.lang.Object
org.eclipse.net4j.util.io.IOUtil
public final class IOUtil
- extends java.lang.Object
Method Summary |
static void |
close(java.io.Closeable closeable)
|
static void |
close(Closeable closeable)
|
static java.lang.Exception |
closeSilent(java.io.Closeable closeable)
|
static java.lang.Exception |
closeSilent(Closeable closeable)
|
static void |
copy(java.io.InputStream input,
java.io.OutputStream output)
|
static void |
copy(java.io.InputStream input,
java.io.OutputStream output,
byte[] buffer)
|
static void |
copy(java.io.InputStream input,
java.io.OutputStream output,
int bufferSize)
|
static int |
copy(java.io.InputStream input,
java.io.OutputStream output,
int size,
byte[] buffer)
|
static void |
copyFile(java.io.File source,
java.io.File target)
|
static void |
copyText(java.io.BufferedReader reader,
java.io.BufferedWriter writer,
IOFilter<java.lang.String>... lineFilters)
|
static void |
copyText(java.io.File source,
java.io.File target,
IOFilter<java.lang.String>... lineFilters)
|
static void |
copyTree(java.io.File source,
java.io.File target)
|
static void |
copyTrees(java.util.Collection<java.io.File> sources,
java.io.File target)
|
static int |
delete(java.io.File file)
|
static boolean |
equals(java.io.File file1,
java.io.File file2)
|
static boolean |
equals(java.io.InputStream stream1,
java.io.InputStream stream2)
|
static java.io.PrintStream |
ERR()
|
static java.io.InputStream |
IN()
|
static java.util.List<java.io.File> |
listBreadthFirst(java.io.File file)
|
static java.util.List<java.io.File> |
listDepthFirst(java.io.File file)
|
static void |
mkdirs(java.io.File folder)
|
static java.io.FileInputStream |
openInputStream(java.io.File file)
|
static java.io.FileInputStream |
openInputStream(java.lang.String fileName)
|
static java.io.FileOutputStream |
openOutputStream(java.io.File file)
|
static java.io.FileOutputStream |
openOutputStream(java.lang.String fileName)
|
static java.io.FileReader |
openReader(java.io.File file)
|
static java.io.FileReader |
openReader(java.lang.String fileName)
|
static java.io.FileWriter |
openWriter(java.io.File file)
|
static java.io.FileWriter |
openWriter(java.lang.String fileName)
|
static java.io.PrintStream |
OUT()
|
static void |
print(java.lang.Throwable t)
|
static void |
print(java.lang.Throwable t,
java.io.PrintStream stream)
|
static byte[] |
readFile(java.io.File file)
|
static void |
safeInput(java.io.File file,
IORunnable<java.io.FileInputStream> runnable)
|
static void |
safeOutput(java.io.File file,
IORunnable<java.io.FileOutputStream> runnable)
|
static void |
safeRead(java.io.File file,
IORunnable<java.io.FileReader> runnable)
|
static
<IO extends java.io.Closeable>
void |
|
safeRun(IO io,
IORunnable<IO> runnable)
|
static void |
safeWrite(java.io.File file,
IORunnable<java.io.FileWriter> runnable)
|
static void |
visitBreadthFirst(java.io.File[] files,
IOVisitor visitor)
|
static void |
visitBreadthFirst(java.io.File file,
IOVisitor visitor)
|
static void |
visitDepthFirst(java.io.File[] files,
IOVisitor visitor)
|
static void |
visitDepthFirst(java.io.File file,
IOVisitor visitor)
|
static void |
writeFile(java.io.File file,
byte[] bytes)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
IN
public static java.io.InputStream IN()
OUT
public static java.io.PrintStream OUT()
ERR
public static java.io.PrintStream ERR()
print
public static void print(java.lang.Throwable t,
java.io.PrintStream stream)
print
public static void print(java.lang.Throwable t)
openInputStream
public static java.io.FileInputStream openInputStream(java.lang.String fileName)
throws IORuntimeException
- Throws:
IORuntimeException
openInputStream
public static java.io.FileInputStream openInputStream(java.io.File file)
throws IORuntimeException
- Throws:
IORuntimeException
openOutputStream
public static java.io.FileOutputStream openOutputStream(java.lang.String fileName)
throws IORuntimeException
- Throws:
IORuntimeException
openOutputStream
public static java.io.FileOutputStream openOutputStream(java.io.File file)
throws IORuntimeException
- Throws:
IORuntimeException
openReader
public static java.io.FileReader openReader(java.lang.String fileName)
throws IORuntimeException
- Throws:
IORuntimeException
openReader
public static java.io.FileReader openReader(java.io.File file)
throws IORuntimeException
- Throws:
IORuntimeException
openWriter
public static java.io.FileWriter openWriter(java.lang.String fileName)
throws IORuntimeException
- Throws:
IORuntimeException
openWriter
public static java.io.FileWriter openWriter(java.io.File file)
throws IORuntimeException
- Throws:
IORuntimeException
closeSilent
public static java.lang.Exception closeSilent(java.io.Closeable closeable)
close
public static void close(java.io.Closeable closeable)
throws IORuntimeException
- Throws:
IORuntimeException
closeSilent
public static java.lang.Exception closeSilent(Closeable closeable)
close
public static void close(Closeable closeable)
throws IORuntimeException
- Throws:
IORuntimeException
mkdirs
public static void mkdirs(java.io.File folder)
delete
public static int delete(java.io.File file)
copyTree
public static void copyTree(java.io.File source,
java.io.File target)
throws IORuntimeException
- Throws:
IORuntimeException
copyTrees
public static void copyTrees(java.util.Collection<java.io.File> sources,
java.io.File target)
throws IORuntimeException
- Throws:
IORuntimeException
copyText
public static void copyText(java.io.File source,
java.io.File target,
IOFilter<java.lang.String>... lineFilters)
throws IORuntimeException
- Throws:
IORuntimeException
copyText
public static void copyText(java.io.BufferedReader reader,
java.io.BufferedWriter writer,
IOFilter<java.lang.String>... lineFilters)
copy
public static int copy(java.io.InputStream input,
java.io.OutputStream output,
int size,
byte[] buffer)
throws IORuntimeException
- Throws:
IORuntimeException
copy
public static void copy(java.io.InputStream input,
java.io.OutputStream output,
byte[] buffer)
throws IORuntimeException
- Throws:
IORuntimeException
copy
public static void copy(java.io.InputStream input,
java.io.OutputStream output,
int bufferSize)
throws IORuntimeException
- Throws:
IORuntimeException
copy
public static void copy(java.io.InputStream input,
java.io.OutputStream output)
throws IORuntimeException
- Throws:
IORuntimeException
copyFile
public static void copyFile(java.io.File source,
java.io.File target)
throws IORuntimeException
- Throws:
IORuntimeException
- See Also:
NIOUtil.copyFile(File, File)
readFile
public static byte[] readFile(java.io.File file)
throws IORuntimeException
- Throws:
IORuntimeException
writeFile
public static void writeFile(java.io.File file,
byte[] bytes)
throws IORuntimeException
- Throws:
IORuntimeException
listDepthFirst
public static java.util.List<java.io.File> listDepthFirst(java.io.File file)
listBreadthFirst
public static java.util.List<java.io.File> listBreadthFirst(java.io.File file)
visitDepthFirst
public static void visitDepthFirst(java.io.File file,
IOVisitor visitor)
throws IORuntimeException
- Throws:
IORuntimeException
visitDepthFirst
public static void visitDepthFirst(java.io.File[] files,
IOVisitor visitor)
visitBreadthFirst
public static void visitBreadthFirst(java.io.File file,
IOVisitor visitor)
throws IORuntimeException
- Throws:
IORuntimeException
visitBreadthFirst
public static void visitBreadthFirst(java.io.File[] files,
IOVisitor visitor)
throws IORuntimeException
- Throws:
IORuntimeException
safeRun
public static <IO extends java.io.Closeable> void safeRun(IO io,
IORunnable<IO> runnable)
throws IORuntimeException
- Throws:
IORuntimeException
safeInput
public static void safeInput(java.io.File file,
IORunnable<java.io.FileInputStream> runnable)
throws IORuntimeException
- Throws:
IORuntimeException
safeOutput
public static void safeOutput(java.io.File file,
IORunnable<java.io.FileOutputStream> runnable)
throws IORuntimeException
- Throws:
IORuntimeException
safeRead
public static void safeRead(java.io.File file,
IORunnable<java.io.FileReader> runnable)
throws IORuntimeException
- Throws:
IORuntimeException
safeWrite
public static void safeWrite(java.io.File file,
IORunnable<java.io.FileWriter> runnable)
throws IORuntimeException
- Throws:
IORuntimeException
equals
public static boolean equals(java.io.InputStream stream1,
java.io.InputStream stream2)
throws IORuntimeException
- Throws:
IORuntimeException
equals
public static boolean equals(java.io.File file1,
java.io.File file2)
throws IORuntimeException
- Throws:
IORuntimeException