|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
org.jcoderz.commons.util.FileUtils
public final class FileUtils
This class collects some nifty file utility functions. TODO: Cleanup check vs. IoUtil
Method Summary | |
---|---|
static void |
close( in)
Deprecated. use IoUtil.close(InputStream) |
static void |
close( out)
Deprecated. use IoUtil.close(OutputStream) |
static void |
copy( src,
destinationDir)
Copies the file or directory src to the
directory destinationDir . |
static void |
copy( in,
out)
Copy from an input stream to an output stream. |
static void |
copyFile( src,
dest)
Copies the file src to the file or directory
dest . |
static void |
copySlashStar( srcDir,
dst)
Copy all files under srcDir to the directory
dst . |
static |
createTempDir( baseDir,
prefix)
Creates a temporary directory. |
static void |
delete( aFile)
Deletes the given file aFile . |
static |
findFile( path,
pattern)
Search for files in a directory hierarchy. |
static |
getRelativePath( baseDir,
file)
Returns the relative path of file to the file
basedir . |
static void |
rename( aFile,
dest)
Renames the file aFile . |
static void |
rmdir( file)
Remove file or directory. |
static void |
safeClose( reader)
Deprecated. use IoUtil.close(Reader) |
static void |
safeClose( writer)
Deprecated. use IoUtil.close(Writer) |
Methods inherited from class java.lang. |
---|
, , , , , , , , , , |
Method Detail |
---|
public static void copy( src, destinationDir) throws
src
to the
directory destinationDir
.
src
- the source file or directory.destinationDir
- the destination directory.
- in case of an I/O error.public static void copyFile( src, dest) throws ,
src
to the file or directory
dest
.
src
- The source file.dest
- The destination file or directory.
- if the source file does not exists.
- in case of an I/O error.public static void copy( in, out) throws
in
- The input stream.out
- The output stream.
- when an error happens during a read or a write
operation.public static void copySlashStar( srcDir, dst) throws
srcDir
to the directory
dst
.
Unix command:
$ cp "$scrDir/*" "$dst"
srcDir
- the source directory.dst
- the destination directory.
- in case of an I/O error.public static createTempDir( baseDir, prefix) throws
baseDir
- the base directory.prefix
- prefix for the temporary directory.
- in case of an I/O error.public static void close( in)
null
reference for the argument.
in
- the input stream that should be closed.public static void close( out)
null
reference for the argument.
out
- the output stream that should be closed.public static void safeClose( reader)
null
reference for the argument.
reader
- the reader that should be closed.public static void safeClose( writer)
null
reference for the argument.
writer
- the writer that should be closed.public static findFile( path, pattern)
find path -name pattern
path
- root directory.pattern
- filename pattern.
pattern
under path
.public static void rmdir( file) throws
rm -rf file
file
- the file or directory to delete.
- in case of an I/O error.public static getRelativePath( baseDir, file) throws
file
to the file
basedir
.
baseDir
- the base directory or file.file
- the file.
- in case of an I/O error.public static void rename( aFile, dest) throws
aFile
.
aFile
- The file to be renamed.dest
- The new abstract pathname for the named file
- if the the renaming was not successful.public static void delete( aFile) throws
aFile
.
aFile
- The file to be deleted.
- if the the deletion was not successful.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |