public class ERXFile
extends java.io.File
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 comparison
contents[i].getName().equals("FilenameWithSpecialCharacterÄÖÜ")
would result in true. This is not the case, at least not on HFS+
This subclass fixes this and should be used instead of java.io.File.
Actually, the code above _does_ work (WO 5.4.3, Mac OS X 10.5.8, java 1.5.0_22),
but what else does this do? -rrk| Constructor and Description |
|---|
ERXFile(java.io.File parent,
java.lang.String child)
Creates a new File instance from a parent abstract pathname and a child pathname string.
|
ERXFile(java.lang.String pathname)
Creates a new File instance by converting the given pathname string into an abstract pathname.
|
ERXFile(java.lang.String parent,
java.lang.String child)
Creates a new File instance from a parent pathname string and a child pathname string.
|
ERXFile(java.net.URI uri)
Creates a new File instance by converting the given file: URI into an abstract pathname.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.File |
getAbsoluteFile() |
java.lang.String |
getAbsolutePath() |
java.io.File |
getCanonicalFile() |
java.lang.String |
getName() |
java.io.File |
getParentFile() |
java.lang.String[] |
list() |
java.lang.String[] |
list(java.io.FilenameFilter arg0) |
java.io.File[] |
listFiles() |
java.io.File[] |
listFiles(java.io.FileFilter arg0) |
java.io.File[] |
listFiles(java.io.FilenameFilter arg0) |
static java.lang.String |
normalizedPath(java.lang.String name) |
java.lang.String |
toString() |
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getCanonicalPath, getFreeSpace, getParent, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toURI, toURLpublic ERXFile(java.io.File parent,
java.lang.String child)
parent - - The parent abstract pathnamechild - - The child pathname stringjava.lang.NullPointerException - - If child is nullpublic ERXFile(java.lang.String pathname)
pathname - - A pathname stringjava.lang.NullPointerException - - If the pathname argument is nullpublic ERXFile(java.lang.String parent,
java.lang.String child)
parent - - The parent pathname stringchild - - The child pathname stringjava.lang.NullPointerException - - If child is nullpublic ERXFile(java.net.URI uri)
f it is guaranteed that
new File(f.toURI()).equals(f.getAbsoluteFile())
so long as the original abstract pathname, the URI, and the new abstract pathname are all
created in (possibly different invocations of) the same Java virtual machine. This relationship
typically does not hold, however, when a file: URI that is created in a virtual machine on one
operating system is converted into an abstract pathname in a virtual machine on a different
operating system.uri - - An absolute, hierarchical URI with a scheme equal to "file", a non-empty path component,
and undefined authority, query, and fragment componentsjava.lang.NullPointerException - - If uri is nulljava.lang.IllegalArgumentException - - If the preconditions on the parameter do not holdpublic java.lang.String getAbsolutePath()
getAbsolutePath in class java.io.Filepublic java.lang.String getName()
getName in class java.io.Filepublic java.lang.String[] list()
list in class java.io.Filepublic java.lang.String[] list(java.io.FilenameFilter arg0)
list in class java.io.Filepublic java.io.File[] listFiles()
listFiles in class java.io.Filepublic java.io.File[] listFiles(java.io.FileFilter arg0)
listFiles in class java.io.Filepublic java.io.File[] listFiles(java.io.FilenameFilter arg0)
listFiles in class java.io.Filepublic java.io.File getAbsoluteFile()
getAbsoluteFile in class java.io.Filepublic java.io.File getCanonicalFile()
throws java.io.IOException
getCanonicalFile in class java.io.Filejava.io.IOExceptionpublic java.io.File getParentFile()
getParentFile in class java.io.Filepublic java.lang.String toString()
toString in class java.io.Filepublic static java.lang.String normalizedPath(java.lang.String name)
Copyright © 2002 – 2022 Project Wonder.