|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.golden.gamedev.util.FileUtil
Utility class for reading and writing text file,
also several methods for processing File
object.
Method Summary | |
static String[] |
fileRead(File file)
Read an array of String from specified text file. |
static String[] |
fileRead(InputStream stream)
|
static String[] |
fileRead(InputStream stream,
String ignore,
boolean readEmpty)
|
static void |
fileWrite(String[] text,
File file)
Writes an array of String to specified text file. |
static String |
getExtension(File f)
Returns the extension of specified file. |
static String |
getExtension(String st)
|
static String |
getName(File f)
Returns the name of specified file without it's extension. |
static String |
getName(String st)
|
static String |
getPath(File f)
Returns the path of specified file. |
static String |
getPath(String st)
|
static String |
getPathName(File f)
Returns the path and the name of specified file without its extension. |
static String |
getPathName(String st)
|
static File |
setExtension(File f,
String ext)
Sets file extension. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void fileWrite(String[] text, File file)
text
- an array of string to write to the file.file
- file to be written.public static String[] fileRead(File file)
file
- file to be read.
public static String[] fileRead(InputStream stream)
public static String[] fileRead(InputStream stream, String ignore, boolean readEmpty)
public static File setExtension(File f, String ext)
"paul.dat"
to "paul.bin"
:
File f = new File("paul.dat"); File newFile = setExtension(f, "bin");
f
- file that it's extension to be renamed.ext
- the new file extension.
public static String getExtension(File f)
"paul.dat"
will return "dat"
.
f
- file to get it's extension.
public static String getExtension(String st)
public static String getName(File f)
"paul.dat"
will return "paul"
.
f
- file to get it's name.
public static String getName(String st)
public static String getPath(File f)
"c:\src\res\paul.dat"
will return
"c:\src\res\"
.
f
- file to get it's path.
public static String getPath(String st)
public static String getPathName(File f)
"c:\src\res\paul.dat"
will return
"c:\src\res\paul"
.
f
- file to get it's pathname.
public static String getPathName(String st)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |