|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.charlesames.utility.io.FileMethods
public abstract class FileMethods
Miscellaneous methods concerned with files.
| Constructor Summary | |
|---|---|
FileMethods()
|
|
| Method Summary | |
|---|---|
static boolean |
fileEquals(java.io.File file1,
java.io.File file2)
|
static java.lang.String |
getFileExtension(java.io.File file)
Get the portion of the file name following the last dot. |
static java.lang.String |
getFileNameWithoutExtension(java.io.File file)
Get the portion of the filename up to, but not including, the last dot. |
static java.io.File |
getNewFile(javax.swing.JFrame frame,
javax.swing.JFileChooser chooser,
java.io.File suggestedFile)
|
static java.lang.String |
getRelativePath(java.io.File targetFile,
java.io.File baseDirectory)
Adapted from http://stackoverflow.com/questions/204784/how-to-construct-a-relative-path-in-java-from-two-absolute-paths-or-urls Get the path from a file relative to a base directory. |
static java.lang.String |
readAll(java.io.File file)
Reads character data from a file in a privileged context. |
static void |
writeAll(java.io.File file,
java.lang.String text)
Writes character data to a file in a privileged context. |
static void |
writeAll(java.io.File file,
java.lang.String text,
java.lang.String encoding)
Writes character data to a file in a privileged context. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileMethods()
| Method Detail |
|---|
public static java.lang.String getFileExtension(java.io.File file)
file - The file.
public static java.lang.String getFileNameWithoutExtension(java.io.File file)
file - The file.
public static java.lang.String readAll(java.io.File file)
file - The file which contains the text.
public static void writeAll(java.io.File file,
java.lang.String text)
file - The file which is to receive the text.text - A long string which is to be written to the file.
public static void writeAll(java.io.File file,
java.lang.String text,
java.lang.String encoding)
file - The file which is to receive the text.text - Text data which is to be written to the file.encoding - A long string which is to be written to the file.
public static java.io.File getNewFile(javax.swing.JFrame frame,
javax.swing.JFileChooser chooser,
java.io.File suggestedFile)
frame - The highest-level GUI object (JFrame)chooser - suggestedFile - An absolute file path
public static java.lang.String getRelativePath(java.io.File targetFile,
java.io.File baseDirectory)
targetFile - targetPath is calculated to this filebaseDirectory - basePath is calculated from this directory
public static boolean fileEquals(java.io.File file1,
java.io.File file2)
file1 - file2 -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||