public class IOUtilities
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
closeQuietly(java.io.Closeable closeable)
Method that will close a
Closeable ignoring it if it is null and ignoring exceptions. |
void |
closeQuietly(java.io.ObjectInput in)
Method that will close an
ObjectInput ignoring it if it is null and ignoring exceptions. |
void |
closeQuietly(java.io.ObjectOutput out)
Method that will close an
ObjectOutput 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(int bufferSize,
ProgressObserver progress,
java.lang.String progressPrefix,
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.
|
static boolean |
copyStream(ProgressObserver progress,
java.lang.String progressPrefix,
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 long |
fileLength(java.io.File file)
Returns the length of a file.
|
static boolean |
moveFile(java.io.File source,
java.io.File dest)
Moves the source file to the destination.
|
public static boolean moveFile(java.io.File source,
java.io.File dest)
false. Otherwise, the contents of the
source are copied to the destination, the source is deleted,
and true is returned.source - The source file to move.dest - The destination where to move the file.public static boolean copyStream(int bufferSize,
@Nullable
ProgressObserver progress,
java.lang.String progressPrefix,
java.io.InputStream in,
java.io.OutputStream out,
boolean canStop)
throws java.io.IOException
bufferSize - the size of the bufferprogress - the progress observer it could be nullprogressPrefix - the progress prefix, it could be nullin - the input streamout - the output streamcanStop - if true, the copy can be stopped by interrupting the threadtrue if the copy was done, false if it was interruptedjava.io.IOException - IOException If an I/O error occurspublic static boolean copyStream(int bufferSize,
@Nullable
ProgressObserver progress,
java.io.InputStream in,
java.io.OutputStream out,
boolean canStop)
throws java.io.IOException
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 threadtrue if the copy was done, false if it was interruptedjava.io.IOException - IOException If an I/O error occurspublic static boolean copyStream(@Nullable
ProgressObserver progress,
java.io.InputStream in,
java.io.OutputStream out,
boolean canStop)
throws java.io.IOException
progress - the progress observer it could be nullin - the input streamout - the output streamcanStop - if true, the copy can be stopped by interrupting the threadtrue if the copy was done, false if it was interruptedjava.io.IOException - IOException If an I/O error occurspublic static boolean copyStream(@Nullable
ProgressObserver progress,
java.lang.String progressPrefix,
java.io.InputStream in,
java.io.OutputStream out,
boolean canStop)
throws java.io.IOException
progress - the progress observer it could be nullprogressPrefix - the progress prefix, it could be nullin - the input streamout - the output streamcanStop - if true, the copy can be stopped by interrupting the threadtrue if the copy was done, false if it was interruptedjava.io.IOException - IOException If an I/O error occurspublic static long fileLength(java.io.File file)
file - the file or directorypublic static void closeQuietly(@Nullable
java.io.Closeable closeable)
Closeable ignoring it if it is null and ignoring exceptions.closeable - the closeable to close.public void closeQuietly(@Nullable
java.io.ObjectInput in)
ObjectInput ignoring it if it is null and ignoring exceptions.in - the closeable to close.public void closeQuietly(@Nullable
java.io.ObjectOutput out)
ObjectOutput ignoring it if it is null and ignoring exceptions.out - the closeable to close.