org.gjt.sp.util
Class IOUtilities

java.lang.Object
  extended by org.gjt.sp.util.IOUtilities

public class IOUtilities
extends java.lang.Object

IO tools that depends on JDK only.

Since:
4.3pre5

Method Summary
static void closeQuietly(java.io.InputStream in)
          Method that will close an InputStream ignoring it if it is null and ignoring exceptions.
static void closeQuietly(java.io.OutputStream out)
          Method that will close an OutputStream ignoring it if it is null and ignoring exceptions.
static void closeQuietly(java.io.Reader r)
          Method that will close an Reader ignoring it if it is null and ignoring exceptions.
static boolean copyStream(int bufferSize, ProgressObserver progress, java.io.InputStream in, java.io.OutputStream out, boolean canStop)
          Copy an input stream to an output stream.
static boolean copyStream(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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copyStream

public static boolean copyStream(int bufferSize,
                                 ProgressObserver progress,
                                 java.io.InputStream in,
                                 java.io.OutputStream out,
                                 boolean canStop)
                          throws java.io.IOException
Copy an input stream to an output stream.

Parameters:
bufferSize - the size of the buffer
progress - the progress observer it could be null
in - the input stream
out - the output stream
canStop - if true, the copy can be stopped by interrupting the thread
Returns:
true if the copy was done, false if it was interrupted
Throws:
java.io.IOException - IOException If an I/O error occurs

copyStream

public static boolean copyStream(ProgressObserver progress,
                                 java.io.InputStream in,
                                 java.io.OutputStream out,
                                 boolean canStop)
                          throws java.io.IOException
Copy an input stream to an output stream with a buffer of 4096 bytes.

Parameters:
progress - the progress observer it could be null
in - the input stream
out - the output stream
canStop - if true, the copy can be stopped by interrupting the thread
Returns:
true if the copy was done, false if it was interrupted
Throws:
java.io.IOException - IOException If an I/O error occurs

closeQuietly

public static void closeQuietly(java.io.InputStream in)
Method that will close an InputStream ignoring it if it is null and ignoring exceptions.

Parameters:
in - the InputStream to close.

closeQuietly

public static void closeQuietly(java.io.OutputStream out)
Method that will close an OutputStream ignoring it if it is null and ignoring exceptions.

Parameters:
out - the OutputStream to close.

closeQuietly

public static void closeQuietly(java.io.Reader r)
Method that will close an Reader ignoring it if it is null and ignoring exceptions.

Parameters:
r - the Reader to close.
Since:
jEdit 4.3pre5