Home | History | Annotate | Download | only in adaptor

Lines Matching refs:file

5  * you may not use this file except in compliance with the License.
25 import java.io.File;
58 File file = locateFile(name);
59 if (file == null) {
60 throw new FileNotFoundException("Could not locate file " + name);
62 return new InputStreamReader(new FileInputStream(file), "UTF-8");
71 text.append("No file '");
97 * @param name name of the file to locate.
98 * @return a File object corresponding to the existing file or {@code null} if it does not exist.
100 File locateFile(String name) {
101 if (name.startsWith(File.separator)) {
102 // Full path to file was given.
103 File file = newFile(name);
104 return file.exists() ? file : null;
106 File file = null;
113 file = newFile(filePath);
114 return file.exists() ? file : null;
118 file = locateFile(getLoadPaths(), name);
119 if (file != null && loadPathCache != null) {
120 loadPathCache.add(getLoadPaths(), name, file.getAbsolutePath());
122 return file;
126 * Given an ordered list of directories to look in, locate the specified file. Returns
127 * <code>null</code> if file not found.
133 * @param filename the name of the file.
134 * @return a File object corresponding to the file. <code>null</code> if file not found.
136 File locateFile(List<String> loadPaths, String filename) {
144 File file = newFile(path, filename);
145 if (file.exists()) {
146 return file;
153 * Separate methods to allow tests to subclass and override File creation and return mocks or
156 File newFile(String filename) {
157 return new File(filename);
160 File newFile(String path, String filename) {
161 return new File(path, filename);
171 if (filename.startsWith(File.separator)) {
174 File file = locateFile(filename);
175 if (file == null) {
176 // The file does not exist, use the full loadpath and file name as the
180 return file.getAbsolutePath();
186 * Some applications, e.g. online help, need to know when a file has changed due to a symlink
187 * modification hence the use of {@link File#getCanonicalFile()}, if possible.
191 File file = locateFile(filename);
192 if (file == null) {
198 fullPath = file.getCanonicalPath();
200 fullPath = file.getAbsolutePath();
202 return String.format("%s@%s", fullPath, file.lastModified());