Package org.eclipse.net4j.util.io
Class IOUtil
java.lang.Object
org.eclipse.net4j.util.io.IOUtil
- Author:
- Eike Stepper
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendText(File file, String text) static voidstatic voidstatic ExceptioncloseSilent(Closeable closeable) static ExceptioncloseSilent(Closeable closeable) static voidcopy(InputStream input, OutputStream output) static voidcopy(InputStream input, OutputStream output, byte[] buffer) static voidcopy(InputStream input, OutputStream output, int bufferSize) static intcopy(InputStream input, OutputStream output, int size, byte[] buffer) static longcopyBinary(InputStream inputStream, OutputStream outputStream) static voidcopyBinary(InputStream inputStream, OutputStream outputStream, long size) static longcopyCharacter(Reader reader, Writer writer) static voidcopyCharacter(Reader reader, Writer writer, long size) static voidstatic voidcopyText(BufferedReader reader, BufferedWriter writer, IOFilter<String>... lineFilters) static voidstatic voidstatic voidcopyTrees(Collection<File> sources, File target) static intstatic booleanstatic booleanequals(InputStream stream1, InputStream stream2) static booleanstatic PrintStreamERR()static voidstatic IOExceptionflushSilent(Flushable flushable) static intstatic InputStreamIN()static IOExceptionioException(Exception ex) static booleanisFreePort(int port) listBreadthFirst(File file) listDepthFirst(File file) static StringmakeRelative(File file, File toFolder) static voidstatic StringnormalizeSeparator(String string) static FileInputStreamopenInputStream(File file) static FileInputStreamopenInputStream(String fileName) static FileOutputStreamopenOutputStream(File file) static FileOutputStreamopenOutputStream(String fileName) static FileReaderopenReader(File file) static FileReaderopenReader(String fileName) static booleanopenSystemBrowser(String url) static FileWriteropenWriter(File file) static FileWriteropenWriter(File file, boolean append) static FileWriteropenWriter(String fileName) static PrintStreamOUT()static voidprint(StackTraceElement[] elements) static voidprint(StackTraceElement[] elements, PrintStream stream) static voidstatic voidprint(Throwable t, PrintStream stream) static byte[]static Stringstatic StringreadTextFile(File file) static voidsafeInput(File file, IORunnable<FileInputStream> runnable) static voidsafeOutput(File file, IORunnable<FileOutputStream> runnable) static voidsafeRead(File file, IORunnable<FileReader> runnable) static <IO extends Closeable>
voidsafeRun(IO io, IORunnable<IO> runnable) static voidsafeWrite(File file, IORunnable<FileWriter> runnable) static Stringstatic voidvisitBreadthFirst(File[] files, IOVisitor visitor) static voidvisitBreadthFirst(File file, IOVisitor visitor) static voidvisitDepthFirst(File[] files, IOVisitor visitor) static voidvisitDepthFirst(File file, IOVisitor visitor) static voidstatic 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
-
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.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
-