|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.calitha.io.FileUtil
public final class FileUtil
| Method Summary | |
|---|---|
static void |
append(File file,
String text)
Appends text to a file. |
static void |
append(File file,
String text,
Charset charset)
Appends text to a file. |
static void |
copyURLToFile(URL url,
File file)
Copies the content of an URL to a file. |
static String |
fileToString(File file,
Charset charset)
Reads the content of the file and returns it as a string. |
static String |
getExtension(File file)
Gets the extension part of a file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void append(File file,
String text)
throws IOException
The text is appended using the UTF-8 character set.
file - file to appendtext - text that will be appended to the file
IOException - if an I/O error occurs
IllegalArgumentException - if the file or text argument is null
public static void append(File file,
String text,
Charset charset)
throws IOException
file - file to appendtext - text that will be appended to the filecharset - the character set used to write the text in the file
IOException - if an I/O error occurs
IllegalArgumentException - if the file, text or charset
argument is nullpublic static String getExtension(File file)
The extension is the part that occurs after the last dot.
file - file
IllegalArgumentException - if the file argument is null
public static void copyURLToFile(URL url,
File file)
throws IOException
url - requested URLfile - output file
IOException - if an I/O error occurs
IllegalArgumentException - if the url or file argument is null
public static String fileToString(File file,
Charset charset)
throws IOException
file - file that will be used as inputcharset - charset/encoding of the file so the bytes can be
transformed into a string
IOException - if an I/O error occurs
IllegalArgumentException - if the file or charset argument is null
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||