File f = new File(System.getProperty("test.dir", "."), "f.txt");
f.createNewFile();
f.deleteOnExit();
FileInputStream fis = new FileInputStream(f); if (testFileInputStream(fis)) { thrownew Exception("Test failed for some of the operation{s}" + " on FileInputStream, check the messages");
}
}
privatestaticboolean testFileInputStream(FileInputStream r) throws Exception {
r.close(); boolean failed = false; boolean result;
System.out.println("Testing File:" + r); for (OpsAfterClose op : OpsAfterClose.values()) {
result = op.check(r); if (!result) {
failed = true;
}
System.out.println(op + ":" + result);
} if (failed) {
System.out.println("Test failed for the failed operation{s}" + " above for the FileInputStream:" + r);
} return failed;
}
}
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.