|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--webcore.utilities.FileUtils
FileUtils class contains several static utility functions that are helpful for use with files.
Constructor Summary | |
FileUtils()
|
Method Summary | |
java.io.FileFilter |
createFileDirFilter(boolean isDirectory)
Returns a FileFilter which will filter based on whether the file is a directory or not |
java.io.FilenameFilter |
createFilenameExtentionFilter(java.lang.String ext)
Returns a FilenameFilter which will filter based on the extension of the file. |
static boolean |
doesFileExist(java.lang.String filePath)
Determines if a file exists |
static java.lang.String |
extractKey(java.lang.String propertyString)
Extracts the key value of a property String of the form: |
static java.lang.String |
extractValue(java.lang.String propertyString)
Extracts the value value of a property String of the form: |
static java.util.Properties |
loadPropertiesFile(java.io.File file)
Loads the contents of a properties file which may contain import statements for other properties files and returns a new java.util.Properties object. |
static java.util.Properties |
loadPropertiesFile(java.io.File file,
java.util.Properties defaults)
Loads the contents of a properties file which may contain import statements for other properties files and returns a new java.util.Properties object. |
static java.util.Properties |
loadPropertiesFile(java.lang.String filePath)
Loads the contents of a properties file which may contain import statements for other properties files and returns a new java.util.Properties object. |
static java.util.Properties |
loadPropertiesFile(java.lang.String filePath,
java.util.Properties defaults)
Loads the contents of a properties file which may contain import statements for other properties files and returns a new java.util.Properties object. |
static java.lang.String |
readFileAsString(java.io.File file)
Reads the entire contents of a file and returns the contents as a String This function should not be used on large files, because it reads the entire contents into memory as a String. |
static java.lang.String |
readFileAsString(java.lang.String filePath)
Reads the entire contents of a file and returns the contents as a String This function should not be used on large files, because it reads the entire contents into memory as a String. |
static void |
writeFileAsString(java.io.File file,
java.lang.String filedata)
Writes the String filedata to a file. |
static void |
writeFileAsString(java.lang.String filePath,
java.lang.String filedata)
Writes the String filedata to a file. |
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 boolean doesFileExist(java.lang.String filePath)
public static java.lang.String readFileAsString(java.lang.String filePath) throws java.io.IOException
This function should not be used on large files, because it reads the entire contents into memory as a String. It is meant to be used on very small text files.
Its counterpart is writeFileAsString();
java.io.IOException
public static java.lang.String readFileAsString(java.io.File file) throws java.io.IOException
This function should not be used on large files, because it reads the entire contents into memory as a String. It is meant to be used on very small text files.
Its counterpart is writeFileAsString();
java.io.IOException
public static void writeFileAsString(java.lang.String filePath, java.lang.String filedata) throws java.io.IOException
Its counterpart is readFileAsString();
java.io.IOException
public static void writeFileAsString(java.io.File file, java.lang.String filedata) throws java.io.IOException
Its counterpart is readFileAsString();
java.io.IOException
public static java.lang.String extractKey(java.lang.String propertyString)
This method is used internally to read property files.
If the String contains no "=" the entire String is returned.
If the String starts with "=" a zero length String is returned.
public static java.lang.String extractValue(java.lang.String propertyString)
This method is used internally to read property files.
If the String contains no "=" a zero length String is returned.
If the String starts with "=" the entire String is after the "=" is returned.
public static java.util.Properties loadPropertiesFile(java.lang.String filePath) throws java.io.IOException
File Input Statements:
If a line starts with "<<" the line is interpreted as a file import
statement. A file import statement is of the form <<
java.io.IOException
public static java.util.Properties loadPropertiesFile(java.io.File file) throws java.io.IOException
File Input Statements:
If a line starts with "<<" the line is interpreted as a file import
statement. A file import statement is of the form <<
java.io.IOException
public static java.util.Properties loadPropertiesFile(java.lang.String filePath, java.util.Properties defaults) throws java.io.IOException
File Input Statements:
If a line starts with "<<" the line is interpreted as a file import
statement. A file import statement is of the form <<
java.io.IOException
public static java.util.Properties loadPropertiesFile(java.io.File file, java.util.Properties defaults) throws java.io.IOException
File Input Statements:
If a line starts with "<<" the line is interpreted as a file import
statement. A file import statement is of the form <<
java.io.IOException
public java.io.FilenameFilter createFilenameExtentionFilter(java.lang.String ext)
public java.io.FileFilter createFileDirFilter(boolean isDirectory)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |