|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.atlanticbb.tantlinger.io.IOUtils
public class IOUtils
Various IO utility methods
Constructor Summary | |
---|---|
IOUtils()
|
Method Summary | |
---|---|
static void |
close(java.io.InputStream c)
Closes a Closeable, swallowing any exceptions |
static void |
close(java.io.OutputStream c)
|
static void |
close(java.io.Reader c)
|
static void |
close(java.io.Writer c)
|
static void |
copy(java.io.File src,
java.io.File dst)
Copies a file. |
static void |
copy(java.io.File src,
java.io.File dst,
boolean overwrite)
Copies a file. |
static void |
copy(java.io.File src,
java.io.File dst,
FileCopyMonitor mon)
Copies a file. |
static void |
copy(java.io.File src,
java.io.File dst,
FileCopyMonitor mon,
boolean overwrite)
Copies a file |
static void |
copy(java.io.InputStream src,
java.io.OutputStream dst)
Copies an InputStream to an OutputStream |
static void |
copy(java.io.InputStream src,
java.io.OutputStream dst,
CopyMonitor mon)
Copies an InputStream to an OutputStream |
static void |
copy(java.io.Reader src,
java.io.Writer dst)
Copies a Reader to a Writer. |
static void |
copy(java.lang.String srcPath,
java.lang.String dstPath)
Copies the file at the specified source path to the destination path. |
static void |
copy(java.lang.String srcPath,
java.lang.String dstPath,
boolean overwrite)
Copies the file at the specified source path to the destination path. |
static void |
copy(java.lang.String srcPath,
java.lang.String dstPath,
FileCopyMonitor mon)
Copies the file at the specified source path to the destination path. |
static void |
copy(java.lang.String srcPath,
java.lang.String dstPath,
FileCopyMonitor mon,
boolean overwrite)
Copies the file at the specified source path to the destination path. |
static void |
copyFiles(java.io.File src,
java.io.File dest)
|
static void |
copyFiles(java.io.File src,
java.io.File dest,
FileCopyMonitor mon)
Recursively copy all files from one directory to another. |
static java.io.File |
createUniqueFile(java.io.File f)
If the specified file already exists, a new, uniquely named file is returned. |
static boolean |
deleteRecursively(java.io.File file)
Recursively deletes a directory, thereby removing all its contents |
static java.io.File[] |
getDirectoryContents(java.io.File rootdir)
|
static java.lang.String |
getExtension(java.io.File f)
Gets the extension of a file e.g anything after the '.' |
static java.lang.String |
getName(java.io.File f)
Gets the name of the file without the extension |
static long |
getTotalBytes(java.io.File file)
Gets the total bytes in the file or directory |
static java.lang.String |
read(java.io.File file)
Reads a File and returns the contents as a String |
static java.lang.String |
read(java.io.InputStream input)
|
static java.lang.String |
read(java.io.Reader input)
Reads a String from a Reader |
static java.lang.String |
sanitize(java.lang.String x)
|
static void |
write(java.io.File file,
java.io.InputStream input)
Writes the raw data from an InputStream to a File |
static void |
write(java.io.File file,
java.lang.String str)
Writes a String to a File using a PrintWriter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IOUtils()
Method Detail |
---|
public static java.io.File[] getDirectoryContents(java.io.File rootdir)
public static java.lang.String sanitize(java.lang.String x)
public static java.lang.String getExtension(java.io.File f)
f
- The file from which to get the extension
public static java.lang.String getName(java.io.File f)
f
- The file
public static java.io.File createUniqueFile(java.io.File f)
f
-
public static void copy(java.io.Reader src, java.io.Writer dst) throws java.io.IOException
src
- dst
-
java.io.IOException
public static void copy(java.io.InputStream src, java.io.OutputStream dst) throws java.io.IOException
src
- dst
-
java.io.IOException
public static void copy(java.io.InputStream src, java.io.OutputStream dst, CopyMonitor mon) throws java.io.IOException
src
- dst
- mon
- monitors the bytes copied and if the copy was aborted
java.io.IOException
public static void copy(java.io.File src, java.io.File dst) throws java.io.FileNotFoundException, java.io.IOException
src
- dst
-
java.io.FileNotFoundException
java.io.IOException
public static void copy(java.io.File src, java.io.File dst, boolean overwrite) throws java.io.FileNotFoundException, java.io.IOException
src
- dst
- overwrite
- If true overwrites the dest file if it exists
java.io.FileNotFoundException
java.io.IOException
public static void copy(java.io.File src, java.io.File dst, FileCopyMonitor mon) throws java.io.FileNotFoundException, java.io.IOException
src
- dst
- mon
- monitors the copy
java.io.FileNotFoundException
java.io.IOException
public static void copy(java.io.File src, java.io.File dst, FileCopyMonitor mon, boolean overwrite) throws java.io.FileNotFoundException, java.io.IOException
src
- The source filedst
- The destination filemon
- Monitors the copyoverwrite
- if true, overwrites a destination file with the same name
otherwise, it creates a new destination file with a unique name before the copy
java.io.FileNotFoundException
java.io.IOException
public static void copy(java.lang.String srcPath, java.lang.String dstPath) throws java.io.FileNotFoundException, java.io.IOException
srcPath
- dstPath
-
java.io.FileNotFoundException
java.io.IOException
public static void copy(java.lang.String srcPath, java.lang.String dstPath, FileCopyMonitor mon) throws java.io.FileNotFoundException, java.io.IOException
srcPath
- mon
- Monitors the copydstPath
-
java.io.FileNotFoundException
java.io.IOException
public static void copy(java.lang.String srcPath, java.lang.String dstPath, boolean overwrite) throws java.io.FileNotFoundException, java.io.IOException
srcPath
- dstPath
- overwrite
- If true overwrites the file at the dest path if it exists
java.io.FileNotFoundException
java.io.IOException
public static void copy(java.lang.String srcPath, java.lang.String dstPath, FileCopyMonitor mon, boolean overwrite) throws java.io.FileNotFoundException, java.io.IOException
srcPath
- dstPath
- mon
- Monitors the copyoverwrite
- If true overwrites the file at the dest path if it exists
java.io.FileNotFoundException
java.io.IOException
public static void copyFiles(java.io.File src, java.io.File dest) throws java.io.IOException, java.io.FileNotFoundException
java.io.IOException
java.io.FileNotFoundException
public static void copyFiles(java.io.File src, java.io.File dest, FileCopyMonitor mon) throws java.io.FileNotFoundException, java.io.IOException
src
- File or directory to copy from.dest
- File or directory to copy to.
java.io.IOException
java.io.FileNotFoundException
java.io.IOException
public static long getTotalBytes(java.io.File file)
file
- A File or directoy.
public static java.lang.String read(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static java.lang.String read(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
file
- The File to read
java.io.FileNotFoundException
java.io.IOException
public static java.lang.String read(java.io.Reader input) throws java.io.IOException
input
-
java.io.IOException
public static void write(java.io.File file, java.lang.String str) throws java.io.FileNotFoundException, java.io.IOException
file
- str
-
java.io.FileNotFoundException
java.io.IOException
public static void write(java.io.File file, java.io.InputStream input) throws java.io.FileNotFoundException, java.io.IOException
file
- input
-
java.io.FileNotFoundException
java.io.IOException
public static boolean deleteRecursively(java.io.File file)
file
- the file or file to delete
public static void close(java.io.InputStream c)
out
- public static void close(java.io.OutputStream c)
public static void close(java.io.Reader c)
public static void close(java.io.Writer c)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |