staticvoid testFile(File f, boolean writeable, long length) throws Exception
{ if (!f.exists()) fail(f, "does not exist"); if (!f.isFile()) fail(f, "is not a file"); if (f.isDirectory()) fail(f, "is a directory"); if (!f.canRead()) fail(f, "is not readable"); if (!Util.isPrivileged() && f.canWrite() != writeable)
fail(f, writeable ? "is not writeable" : "is writeable"); if (f.length() != length) fail(f, "has wrong length");
}
show(rwFile);
testFile(rwFile, true, bytes.length);
rwFile.delete(); if (rwFile.exists()) {
fail(rwFile, "could not delete");
}
show(roFile);
testFile(roFile, false, 0);
show(thisDir); if (!thisDir.exists()) fail(thisDir, "does not exist"); if (thisDir.isFile()) fail(thisDir, "is a file"); if (!thisDir.isDirectory()) fail(thisDir, "is not a directory"); if (!thisDir.canRead()) fail(thisDir, "is readable"); if (!thisDir.canWrite()) fail(thisDir, "is writeable");
String[] fs = thisDir.list(); if (fs == null) fail(thisDir, "list() returned null");
out.print(" [" + fs.length + "]"); for (int i = 0; i < fs.length; i++) {
out.print(" " + fs[i]);
}
out.println(); if (fs.length == 0) fail(thisDir, "is empty");
if (!dir.mkdir() || !dir.exists() || !dir.isDirectory()) {
fail(dir, "could not create");
} if (!dir.renameTo(dir2)) {
fail(dir, "failed to rename");
} if (dir.exists() || !dir2.exists() || !dir2.isDirectory()) {
fail(dir, "not renamed");
}
System.err.println("NOTE: Large files not supported on this system");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.