|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.schmant.support.io.FileSupport
public final class FileSupport
This class contains static utility methods for working with java.io.File
:s.
Method Summary | |
---|---|
static void |
copyFile(File from,
File to)
Copy the contents of the from file to the to file. |
static String |
getFileNameExtension(File f)
Get the file name extension for the supplied file. |
static String |
getFileNameExtension(String fileName)
Get the file name extension for the supplied file name. |
static byte[] |
readBinaryFile(File f)
Read the contents of the file into a byte array. |
static String |
readTextFile(File f)
Read the text file to a String . |
static String |
readTextFile(File f,
Charset cs)
Read the text file to a String . |
static String |
readTextFile(File f,
String cs)
Read the text file to a String . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String getFileNameExtension(String fileName)
fileName
- The file name.
public static String getFileNameExtension(File f)
f
- The file.
public static byte[] readBinaryFile(File f) throws WrappedIOException
byte
array.
The code here is borrowed from EntityFS Files.readTextFile()
and
adapted to work on java.io.File
:s.
f
- The file to read.
WrappedIOException
- On I/O errors.public static String readTextFile(File f)
String
.
The code here is borrowed from EntityFS Files.readTextFile()
and
adapted to work on java.io.File
:s.
f
- The file to read.
String
.public static String readTextFile(File f, String cs) throws SchmantException
String
.
The code here is borrowed from EntityFS Files.readTextFile()
and
adapted to work on java.io.File
:s.
f
- The file to read.cs
- The name of the charset to use for decoding the file contents.
String
.
SchmantException
- If cs
is not the name of a character
encoding that the running JVM knows about.readTextFile(File, Charset)
public static String readTextFile(File f, Charset cs)
String
.
f
- The file to read.cs
- The name of the charset to use for decoding the file contents.
String
.readTextFile(File, String)
public static void copyFile(File from, File to) throws EntityNotFoundException, WrongEntityTypeException, WrappedIOException, SchmantException
from
file to the to
file. Any
existing contents of to
will be overwritten.
from
- The file to copy from.to
- The file to copy to.
EntityNotFoundException
- If from
does not exist.
WrongEntityTypeException
- If from
is not a file.
WrappedIOException
- On I/O errors.
SchmantException
- On other errors.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |