Package org.gjt.sp.util
Class IOUtilities
- java.lang.Object
-
- org.gjt.sp.util.IOUtilities
-
public class IOUtilities extends java.lang.ObjectIO tools that depend on JDK only.- Since:
- 4.3pre5
- Version:
- $Id: IOUtilities.java 22995 2013-05-17 09:27:17Z kpouer $
- Author:
- Matthieu Casanova
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidcloseQuietly(java.io.Closeable closeable)Method that will close aCloseableignoring it if it is null and ignoring exceptions.static voidcloseQuietly(java.io.InputStream in)Deprecated.we want to remove this method without breaking compatibility with your plugin.voidcloseQuietly(java.io.ObjectInput in)Method that will close anObjectInputignoring it if it is null and ignoring exceptions.voidcloseQuietly(java.io.ObjectOutput out)Method that will close anObjectOutputignoring it if it is null and ignoring exceptions.static voidcloseQuietly(java.io.OutputStream out)Deprecated.we want to remove this method without breaking compatibility with your plugin.static voidcloseQuietly(java.io.Reader r)Deprecated.we want to remove this method without breaking compatibility with your plugin.static voidcloseQuietly(java.io.Writer out)Deprecated.we want to remove this method without breaking compatibility with your plugin.static booleancopyStream(int bufferSize, ProgressObserver progress, java.io.InputStream in, java.io.OutputStream out, boolean canStop)Copy an input stream to an output stream.static booleancopyStream(ProgressObserver progress, java.io.InputStream in, java.io.OutputStream out, boolean canStop)Copy an input stream to an output stream with a buffer of 4096 bytes.static longfileLength(java.io.File file)Returns the length of a file.static booleanmoveFile(java.io.File source, java.io.File dest)Moves the source file to the destination.
-
-
-
Method Detail
-
moveFile
public static boolean moveFile(java.io.File source, java.io.File dest)Moves the source file to the destination. If the destination cannot be created or is a read-only file, the method returnsfalse. Otherwise, the contents of the source are copied to the destination, the source is deleted, andtrueis returned.- Parameters:
source- The source file to move.dest- The destination where to move the file.- Returns:
- true on success, false otherwise.
- Since:
- jEdit 4.3pre9
-
copyStream
public static boolean copyStream(int bufferSize, @Nullable ProgressObserver progress, java.io.InputStream in, java.io.OutputStream out, boolean canStop) throws java.io.IOExceptionCopy an input stream to an output stream.- Parameters:
bufferSize- the size of the bufferprogress- the progress observer it could be nullin- the input streamout- the output streamcanStop- if true, the copy can be stopped by interrupting the thread- Returns:
trueif the copy was done,falseif it was interrupted- Throws:
java.io.IOException- IOException If an I/O error occurs
-
copyStream
public static boolean copyStream(@Nullable ProgressObserver progress, java.io.InputStream in, java.io.OutputStream out, boolean canStop) throws java.io.IOExceptionCopy an input stream to an output stream with a buffer of 4096 bytes.- Parameters:
progress- the progress observer it could be nullin- the input streamout- the output streamcanStop- if true, the copy can be stopped by interrupting the thread- Returns:
trueif the copy was done,falseif it was interrupted- Throws:
java.io.IOException- IOException If an I/O error occurs
-
fileLength
public static long fileLength(java.io.File file)
Returns the length of a file. If it is a directory it will calculate recursively the length.- Parameters:
file- the file or directory- Returns:
- the length of the file or directory. If the file doesn't exist it will return 0
- Since:
- 4.3pre10
-
closeQuietly
@Deprecated public static void closeQuietly(@Nullable java.io.InputStream in)Deprecated.we want to remove this method without breaking compatibility with your plugin. Closeable works for this type as of Java5.Method that will close anInputStreamignoring it if it is null and ignoring exceptions.- Parameters:
in- the InputStream to close.- See Also:
closeQuietly(Closeable)
-
closeQuietly
@Deprecated public static void closeQuietly(@Nullable java.io.OutputStream out)Deprecated.we want to remove this method without breaking compatibility with your plugin. Closeable works for this type as of Java5.Method that will close anOutputStreamignoring it if it is null and ignoring exceptions.- Parameters:
out- the OutputStream to close.- See Also:
closeQuietly(Closeable)
-
closeQuietly
@Deprecated public static void closeQuietly(@Nullable java.io.Reader r)Deprecated.we want to remove this method without breaking compatibility with your plugin. Closeable works for this type as of Java5.Method that will close anReaderignoring it if it is null and ignoring exceptions.- Parameters:
r- the Reader to close.- Since:
- jEdit 4.3pre5
- See Also:
closeQuietly(Closeable)
-
closeQuietly
@Deprecated public static void closeQuietly(@Nullable java.io.Writer out)Deprecated.we want to remove this method without breaking compatibility with your plugin. Closeable works for this type as of Java5.Method that will close aWriterignoring it if it is null and ignoring exceptions.- Parameters:
out- the Writer to close.- See Also:
closeQuietly(Closeable)
-
closeQuietly
public static void closeQuietly(@Nullable java.io.Closeable closeable)Method that will close aCloseableignoring it if it is null and ignoring exceptions.- Parameters:
closeable- the closeable to close.- Since:
- jEdit 4.3pre8
-
closeQuietly
public void closeQuietly(@Nullable java.io.ObjectInput in)Method that will close anObjectInputignoring it if it is null and ignoring exceptions.- Parameters:
in- the closeable to close.- Since:
- jEdit 5.1pre1
-
closeQuietly
public void closeQuietly(@Nullable java.io.ObjectOutput out)Method that will close anObjectOutputignoring it if it is null and ignoring exceptions.- Parameters:
out- the closeable to close.- Since:
- jEdit 5.1pre1
-
-