|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.oktiva.util.FileUtil
File utility class.
Original code from http://forum.java.sun.com
Field Summary | |
static java.lang.String |
lineFeed
Allows cross-platform compatibility. |
Method Summary | |
static void |
copy(java.io.File src,
java.io.File dest)
Copy files and/or directories. |
static void |
deleteFile(java.io.File file)
Deletes a file or a directory along with all files and directories it contains. |
static java.lang.String |
readFile(java.io.File file)
Returns a string containing the contents of a file. |
static java.lang.String |
readFile(java.io.FileReader fileReader)
Returns a string containing the contents of a file. |
static java.lang.String |
readFile(java.lang.String filename)
Returns a string containing the contents of a file. |
static java.lang.String[] |
readFileAsArray(java.io.File file)
Returns a string array containing the contents of a file (one line en each array item). |
static java.lang.String[] |
readFileAsArray(java.io.FileReader fileReader)
Returns a string array containing the contents of a file (one line en each array item). |
static java.lang.String[] |
readFileAsArray(java.lang.String filename)
Returns a string array containing the contents of a file (one line en each array item). |
static void |
writeFile(java.lang.String text,
java.io.File file)
Write a string to a file. |
static void |
writeFile(java.lang.String text,
java.io.FileWriter fileWriter)
Write a string to a file. |
static void |
writeFile(java.lang.String text,
java.lang.String filename)
Write a string to a file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String lineFeed
Method Detail |
public static final void copy(java.io.File src, java.io.File dest) throws java.io.IOException
src
- source file or directorydest
- destination file or directory
java.io.IOException
- if operation failspublic static final void deleteFile(java.io.File file) throws java.io.IOException
file
- the file or directory to delete
java.io.IOException
- if operation failspublic static final java.lang.String readFile(java.io.File file) throws java.io.IOException
file
- the file to read
java.io.IOException
public static final java.lang.String readFile(java.lang.String filename) throws java.io.IOException
filename
- the name of the file
java.io.IOException
public static final java.lang.String readFile(java.io.FileReader fileReader) throws java.io.IOException
fileReader
- the FileReader to use
java.io.IOException
public static final java.lang.String[] readFileAsArray(java.io.File file) throws java.io.IOException
file
- the file to read
java.io.IOException
public static final java.lang.String[] readFileAsArray(java.lang.String filename) throws java.io.IOException
filename
- the name of the file
java.io.IOException
public static final java.lang.String[] readFileAsArray(java.io.FileReader fileReader) throws java.io.IOException
fileReader
- the FileReader to use
java.io.IOException
public static final void writeFile(java.lang.String text, java.io.File file) throws java.io.IOException
text
- The string to write to the file.file
- The file to write.
java.io.IOException
- If the write operation fails.public static final void writeFile(java.lang.String text, java.lang.String filename) throws java.io.IOException
text
- The string to write to the file.filename
- The name of the file to write.
java.io.IOException
- If the write operation fails.public static final void writeFile(java.lang.String text, java.io.FileWriter fileWriter) throws java.io.IOException
text
- The string to write to the file.fileWriter
- The FileWriter to use
java.io.IOException
- If the write operation fails.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |