Home | History | Annotate | Download | only in util

Lines Matching refs:File

5  * you may not use this file except in compliance with the License.
19 import java.io.File;
24 * File I/O utilities.
35 * Reads the named file, translating {@link IOException} to a
38 * @param fileName non-null; name of the file to read
39 * @return non-null; contents of the file
42 File file = new File(fileName);
43 return readFile(file);
47 * Reads the given file, translating {@link IOException} to a
50 * @param file non-null; the file to read
51 * @return non-null; contents of the file
53 public static byte[] readFile(File file) {
54 if (!file.exists()) {
55 throw new RuntimeException(file + ": file not found");
58 if (!file.isFile()) {
59 throw new RuntimeException(file + ": not a file");
62 if (!file.canRead()) {
63 throw new RuntimeException(file + ": file not readable");
66 long longLength = file.length();
69 throw new RuntimeException(file + ": file too long");
75 FileInputStream in = new FileInputStream(file);
80 throw new RuntimeException(file + ": unexpected EOF");
87 throw new RuntimeException(file + ": trouble reading", ex);