Lines Matching defs:file

5  * you may not use this file except in compliance with the License.
40 * the resulting file would exist beneath {@code parentDir}. Useful if {@code name} could
43 * @throws java.io.IOException if the file would not exist beneath {@code parentDir}
99 public static void makeWorldReadable(File file) throws IOException {
100 if (!file.setReadable(true, false /* ownerOnly */)) {
101 throw new IOException("Unable to make " + file + " world-readable");
106 * Calculates the checksum from the contents of a file.
108 public static long calculateChecksum(File file) throws IOException {
111 try (FileInputStream fis = new FileInputStream(file)) {
128 public static void ensureFileDoesNotExist(File file) throws IOException {
129 if (file.exists()) {
130 if (!file.isFile()) {
131 throw new IOException(file + " is not a file");
133 doDelete(file);
137 public static void doDelete(File file) throws IOException {
138 if (!file.delete()) {
139 throw new IOException("Unable to delete: " + file);
143 public static boolean isSymlink(File file) throws IOException {
144 String baseName = file.getName();
146 new File(file.getParentFile().getCanonicalFile(), baseName).getPath();
147 return !file.getCanonicalPath().equals(canonicalPathExceptBaseName);
152 for (File file : toDelete.listFiles()) {
153 if (file.isDirectory() && !FileUtils.isSymlink(file)) {
156 deleteRecursive(file);
159 FileUtils.doDelete(file);
173 File file = new File(rootDir, fileName);
174 if (!file.exists()) {
182 * Read all lines from a UTF-8 encoded file, returning them as a list of strings.
184 public static List<String> readLines(File file) throws IOException {
185 FileInputStream in = new FileInputStream(file);