|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.util.FileUtil
public class FileUtil
Common utility methods for working with Files.
We needed a place to refactor common File-processing idioms in JMRI code, so this class was created. It's more of a library of procedures than a real class, as (so far) all of the operations have needed no state information.
In particular, this is intended to provide Java 2 functionality on a Java 1.1.8 system, or at least try to fake it.
| Constructor Summary | |
|---|---|
FileUtil()
|
|
| Method Summary | |
|---|---|
static String |
getExternalFilename(String pName)
Find the resource file corresponding to a name. |
static String |
getPortableFilename(File file)
Convert a File object to our preferred storage form. |
static String |
getPortableFilename(String filename)
Convert a filename string to our preferred storage form. |
static String |
getUrl(File file)
Provide a URL for a given file. |
static String |
getUrlViaUri(File file)
Provide the URL for a particular file/directory via the URI form. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileUtil()
| Method Detail |
|---|
public static String getExternalFilename(String pName)
pName - The name string, possibly starting with file: or resource:
public static String getPortableFilename(File file)
getExternalFilename(String pName).
Deprecated forms are not created.
file - File to be representedpublic static String getPortableFilename(String filename)
getExternalFilename(String pName).
Deprecated forms are not created.
filename - Filename to be representedpublic static String getUrlViaUri(File file)
public static String getUrl(File file)
In version 1.7.2 and before, this would attempt to create the URL via the toURI() method of File. This is found to not work on all Windows PCs and JVMs. To enable the using code to do appropriate retries, this method doesn't use toURI(), and the FileUtil.getUrlViaUri() method does. To see an example of hos to use this, look at the XmlFIle class (which should be handling your XML I/O in any case).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||