Lines Matching defs:file
12 * version 2 for more details (a copy is included in the LICENSE file that
42 static final String FILE_CONTENTS = "This is a small file!";
47 /* create the file and write its contents */
48 File file = File.createTempFile(fileName, null);
49 file.deleteOnExit();
50 FileOutputStream fos = new FileOutputStream(file);
54 test(true, file);
55 file.delete();
58 private static void test(boolean exists, File file) throws Throwable {
59 /* PrintWriter(File file, String csn) */
61 new PrintWriter(file, UNSUPPORTED_CHARSET);
67 check(exists, file);
70 new PrintWriter(file, null);
76 check(exists, file);
80 new PrintWriter(file.getName(), UNSUPPORTED_CHARSET);
86 check(exists, file);
89 new PrintWriter(file.getName(), null);
95 check(exists, file);
98 private static void check(boolean exists, File file) {
100 /* the file should be unchanged */
101 verifyContents(file);
103 /* the file should not have been created */
104 if (file.exists()) { fail(file + " should not have been created"); }
108 private static void verifyContents(File file) {
109 try (FileInputStream fis = new FileInputStream(file)) {
114 fail("file contents have been altered");