|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.croftsoft.core.io.FileLib
public final class FileLib
A library of static methods to manipulate File objects.
Method Summary | |
---|---|
static File |
findFile(String dirname,
String filename,
boolean ignoreFilenameCase)
Returns null if the file does not already exist. |
static String |
getExtension(File file)
Parses out the file name extension. |
static String |
loadTextFile(String filename)
Loads the text file content into a String. |
static void |
main(String[] args)
Test method. |
static boolean |
makeParents(String pathFilename)
Creates the parent directories for a file specified by a combined path and filename String. |
static String |
pareExtension(String fileName)
Strips off the file name extension. |
static boolean |
replaceBytes(File file,
byte[] oldBytes,
byte[] newBytes)
Replaces instances of oldBytes with newBytes in the inFile. |
static boolean |
replaceBytes(File inFile,
File outFile,
byte[] oldBytes,
byte[] newBytes)
Copies inFile to outFile with the replacement of occurrences of oldBytes with newBytes. |
static boolean |
replaceStrings(File inFile,
File outFile,
String oldString,
String newString)
Copies inFile to outFile with the replacement of occurrences of oldString with newString. |
static boolean |
replaceStrings(File file,
String oldString,
String newString)
Replaces instances of oldString with newString in the inFile. |
static void |
saveTextFile(String filename,
String text)
Saves text to 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 main(String[] args)
public static File findFile(String dirname, String filename, boolean ignoreFilenameCase)
public static String getExtension(File file)
public static boolean makeParents(String pathFilename)
public static boolean replaceStrings(File file, String oldString, String newString) throws FileNotFoundException, IOException
Creates a temporary file (inFile + ".tmp") in the process.
FileNotFoundException
IOException
public static boolean replaceBytes(File file, byte[] oldBytes, byte[] newBytes) throws FileNotFoundException, IOException
Creates a temporary file (inFile + ".tmp") in the process.
FileNotFoundException
IOException
public static boolean replaceStrings(File inFile, File outFile, String oldString, String newString) throws FileNotFoundException, IOException
Any pre-existing outFile is overwritten.
FileNotFoundException
IOException
public static boolean replaceBytes(File inFile, File outFile, byte[] oldBytes, byte[] newBytes) throws FileNotFoundException, IOException
Any pre-existing outFile is overwritten.
FileNotFoundException
IOException
public static String loadTextFile(String filename) throws IOException
IOException
public static String pareExtension(String fileName)
public static void saveTextFile(String filename, String text) throws IOException
IOException
|
CroftSoft Javadoc | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |