Package org.eclipse.net4j.util.io
Class IOUtil
java.lang.Object
org.eclipse.net4j.util.io.IOUtil
- Author:
- Eike Stepper
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
appendText
(File file, String text) static void
static void
static Exception
closeSilent
(Closeable closeable) static Exception
closeSilent
(Closeable closeable) static void
copy
(InputStream input, OutputStream output) static void
copy
(InputStream input, OutputStream output, byte[] buffer) static void
copy
(InputStream input, OutputStream output, int bufferSize) static int
copy
(InputStream input, OutputStream output, int size, byte[] buffer) static long
copyBinary
(InputStream inputStream, OutputStream outputStream) static void
copyBinary
(InputStream inputStream, OutputStream outputStream, long size) static long
copyCharacter
(Reader reader, Writer writer) static void
copyCharacter
(Reader reader, Writer writer, long size) static void
static void
copyText
(BufferedReader reader, BufferedWriter writer, IOFilter<String>... lineFilters) static void
static void
static void
copyTrees
(Collection<File> sources, File target) static int
static boolean
static boolean
equals
(InputStream stream1, InputStream stream2) static boolean
static PrintStream
ERR()
static void
static IOException
flushSilent
(Flushable flushable) static int
static InputStream
IN()
static IOException
ioException
(Exception ex) static boolean
isFreePort
(int port) listBreadthFirst
(File file) listDepthFirst
(File file) static String
makeRelative
(File file, File toFolder) static void
static URL
static String
normalizeSeparator
(String string) static FileInputStream
openInputStream
(File file) static FileInputStream
openInputStream
(String fileName) static FileOutputStream
openOutputStream
(File file) static FileOutputStream
openOutputStream
(String fileName) static FileReader
openReader
(File file) static FileReader
openReader
(String fileName) static boolean
openSystemBrowser
(String url) static FileWriter
openWriter
(File file) static FileWriter
openWriter
(File file, boolean append) static FileWriter
openWriter
(String fileName) static PrintStream
OUT()
static void
print
(StackTraceElement[] elements) static void
print
(StackTraceElement[] elements, PrintStream stream) static void
static void
print
(Throwable t, PrintStream stream) static byte[]
static String
static String
static String
readTextFile
(File file) static void
safeInput
(File file, IORunnable<FileInputStream> runnable) static void
safeOutput
(File file, IORunnable<FileOutputStream> runnable) static void
safeRead
(File file, IORunnable<FileReader> runnable) static <IO extends Closeable>
voidsafeRun
(IO io, IORunnable<IO> runnable) static void
safeWrite
(File file, IORunnable<FileWriter> runnable) static String
static void
visitBreadthFirst
(File[] files, IOVisitor visitor) static void
visitBreadthFirst
(File file, IOVisitor visitor) static void
visitDepthFirst
(File[] files, IOVisitor visitor) static void
visitDepthFirst
(File file, IOVisitor visitor) static void
static void
-
Field Details
-
EOF
public static final int EOF- Since:
- 3.1
- See Also:
-
DEFAULT_TIMEOUT
public static final long DEFAULT_TIMEOUT- Since:
- 3.1
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE- See Also:
-
WILDCARD_SINGLE_CHAR
- Since:
- 2.0
- See Also:
-
WILDCARD_MULTI_CHARS
- Since:
- 2.0
- See Also:
-
WILDCARD_MULTI_DIRS
- Since:
- 2.0
- See Also:
-
-
Method Details
-
IN
-
OUT
-
ERR
-
ioException
- Since:
- 3.13
-
print
- Since:
- 3.1
-
print
- Since:
- 3.1
-
print
-
print
-
toString
- Since:
- 2.0
-
isFreePort
public static boolean isFreePort(int port) - Since:
- 3.5
-
getFreePort
- Throws:
IOException
- Since:
- 3.5
-
newURL
- Throws:
MalformedURLException
- Since:
- 3.25
-
openSystemBrowser
- Since:
- 3.5
-
openInputStream
- Throws:
IORuntimeException
-
openInputStream
- Throws:
IORuntimeException
-
openOutputStream
- Throws:
IORuntimeException
-
openOutputStream
- Throws:
IORuntimeException
-
openReader
- Throws:
IORuntimeException
-
openReader
- Throws:
IORuntimeException
-
openWriter
- Throws:
IORuntimeException
-
openWriter
- Throws:
IORuntimeException
- Since:
- 3.9
-
openWriter
- Throws:
IORuntimeException
-
closeSilent
-
close
- Throws:
IORuntimeException
-
closeSilent
-
close
- Throws:
IORuntimeException
-
flushSilent
- Since:
- 3.3
-
flush
- Throws:
IORuntimeException
- Since:
- 3.3
-
makeRelative
- Since:
- 2.0
-
normalizeSeparator
- Since:
- 2.0
-
mkdirs
-
delete
-
copyTree
- Throws:
IORuntimeException
-
copyTrees
- Throws:
IORuntimeException
-
copyText
@SafeVarargs public static void copyText(File source, File target, IOFilter<String>... lineFilters) throws IORuntimeException - Throws:
IORuntimeException
-
copyText
@SafeVarargs public static void copyText(BufferedReader reader, BufferedWriter writer, IOFilter<String>... lineFilters) -
copyBinary
public static long copyBinary(InputStream inputStream, OutputStream outputStream) throws IOException - Throws:
IOException
- Since:
- 3.1
-
copyBinary
public static void copyBinary(InputStream inputStream, OutputStream outputStream, long size) throws IOException - Throws:
IOException
- Since:
- 3.1
-
copyCharacter
- Throws:
IOException
- Since:
- 3.1
-
copyCharacter
- Throws:
IOException
- Since:
- 3.1
-
copy
public static int copy(InputStream input, OutputStream output, int size, byte[] buffer) throws IORuntimeException - Throws:
IORuntimeException
-
copy
public static void copy(InputStream input, OutputStream output, byte[] buffer) throws IORuntimeException - Throws:
IORuntimeException
-
copy
public static void copy(InputStream input, OutputStream output, int bufferSize) throws IORuntimeException - Throws:
IORuntimeException
-
copy
- Throws:
IORuntimeException
-
copyFile
- Throws:
IORuntimeException
- See Also:
-
readText
- Throws:
IORuntimeException
- Since:
- 3.25
-
readText
- Throws:
IORuntimeException
- Since:
- 3.4
-
readTextFile
- Throws:
IORuntimeException
- Since:
- 3.1
-
readFile
- Throws:
IORuntimeException
-
writeFile
- Throws:
IORuntimeException
-
writeText
- Throws:
IORuntimeException
- Since:
- 3.9
-
appendText
- Throws:
IORuntimeException
- Since:
- 3.23
-
listDepthFirst
-
listBreadthFirst
-
visitDepthFirst
- Throws:
IORuntimeException
-
visitDepthFirst
-
visitBreadthFirst
- Throws:
IORuntimeException
-
visitBreadthFirst
- Throws:
IORuntimeException
-
safeRun
public static <IO extends Closeable> void safeRun(IO io, IORunnable<IO> runnable) throws IORuntimeException - Throws:
IORuntimeException
-
safeInput
public static void safeInput(File file, IORunnable<FileInputStream> runnable) throws IORuntimeException - Throws:
IORuntimeException
-
safeOutput
public static void safeOutput(File file, IORunnable<FileOutputStream> runnable) throws IORuntimeException - Throws:
IORuntimeException
-
safeRead
- Throws:
IORuntimeException
-
safeWrite
- Throws:
IORuntimeException
-
equals
- Throws:
IORuntimeException
-
equals
- Throws:
IORuntimeException
- Since:
- 3.2
-
equals
- Throws:
IORuntimeException
-
glob
- Since:
- 2.0
-