er.extensions
Class ERXFile
java.lang.Object
java.io.File
er.extensions.ERXFile
- All Implemented Interfaces:
- Comparable, Serializable
- public class ERXFile
- extends File
- Author:
- david teran
This class fixes some inconsistencies with java.io.File on MacOS X HFS+ filesystem
The following code does not work as expected:
File f = new File("/tmp/FilenameWithSpecialCharacter€…†");
f.createNewFile();
File tmp = new File("/tmp");
File[] contents = tmp.listFiles();
for (int i = 0; i < contents.length; i++) {
if (contents[i].getName().equals("FilenameWithSpecialCharacter€…†")) {
System.out.println("found it!");
}
}
One would expect that the comparision
contents[i].getName().equals("FilenameWithSpecialCharacter€…†")
would result to true
. This is not the case, at least not on HFS+
This subclass fixes this and should be used instead of java.io.File.
- See Also:
- Serialized Form
Methods inherited from class java.io.File |
canRead, canWrite, compareTo, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getCanonicalPath, getParent, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, listRoots, mkdir, mkdirs, renameTo, setLastModified, setReadOnly, toURI, toURL |
ERXFile
public ERXFile(File arg0,
String arg1)
- Parameters:
arg0
- arg1
-
ERXFile
public ERXFile(String arg0)
- Parameters:
arg0
-
ERXFile
public ERXFile(String arg0,
String arg1)
- Parameters:
arg0
- arg1
-
ERXFile
public ERXFile(URI arg0)
- Parameters:
arg0
-
getAbsolutePath
public String getAbsolutePath()
getName
public String getName()
list
public String[] list()
list
public String[] list(FilenameFilter arg0)
listFiles
public File[] listFiles()
listFiles
public File[] listFiles(FileFilter arg0)
listFiles
public File[] listFiles(FilenameFilter arg0)
getAbsoluteFile
public File getAbsoluteFile()
getCanonicalFile
public File getCanonicalFile()
throws IOException
- Throws:
IOException
getParentFile
public File getParentFile()
toString
public String toString()
Copyright © 2002 – 2004 Project Wonder.