|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.taleo.integration.client.customstep.util.FileUtils
public final class FileUtils
Utility class that wraps some file functions.
Constructor Summary | |
---|---|
FileUtils()
|
Method Summary | |
---|---|
static java.io.File |
createTempFile(java.lang.String folder,
java.lang.String prefix)
Create a temporary file using the specified folder path and filename prefix. |
static java.io.File |
createTempFile(java.lang.String folder,
java.lang.String prefix,
boolean deleteOnExit)
Create a temporary file using the specified folder path and filename prefix and a flag to indicate delete on exit. |
static int |
getLineCount(java.io.File file)
Get the line count. |
static java.io.File[] |
getMatchingFiles(java.io.File pattern)
Get files matching a pattern. |
static java.lang.String |
readFileToString(java.io.File file,
java.lang.String encoding)
Return the file content as a String. |
static java.lang.String |
sanitizeFilename(java.lang.String filename)
Limits the length of a filename to 180 characters. |
static void |
sortFilesByNameAscending(java.io.File[] files,
boolean asc)
Sort an array of files by their name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileUtils()
Method Detail |
---|
public static java.io.File createTempFile(java.lang.String folder, java.lang.String prefix) throws java.io.IOException
com.taleo.integration.compress.tempfile
.
folder
- The folder in which to create the fileprefix
- The filename prefix.
java.io.IOException
public static java.io.File createTempFile(java.lang.String folder, java.lang.String prefix, boolean deleteOnExit) throws java.io.IOException
com.taleo.integration.compress.tempfile
.
folder
- The folder in which to create the fileprefix
- The filename prefix.deleteOnExit
- Delete file on exit.
java.io.IOException
public static void sortFilesByNameAscending(java.io.File[] files, boolean asc)
files
- The array of files.asc
- Sort ascending.public static java.lang.String sanitizeFilename(java.lang.String filename)
filename
- The filename only, excluding path.
public static int getLineCount(java.io.File file) throws java.io.IOException
filename
-
java.io.IOException
public static java.lang.String readFileToString(java.io.File file, java.lang.String encoding) throws java.io.IOException
file
- The file.encoding
- The encoding of the file.
java.io.IOException
public static java.io.File[] getMatchingFiles(java.io.File pattern) throws java.io.IOException
pattern
- The file pattern. If file only, it is considered in the
current directory.
java.io.IOException
WildcardFileFilter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |