/** * Get index file, may be in cache directory, may not exist * * @param fileLocation full path of original index filename * @return File, possibly in cache, may or may not exist */ static public File getFileOrCache(String fileLocation) { File result = getExistingFileOrCache(fileLocation); if (result != null) return result; return getDiskCache2().getFile(fileLocation); }
@Test public void testNotExist() throws Exception { DiskCache2 cache = DiskCache2.getDefault(); File file = cache.getFile("gfs.t00z.master.grbf00.10m.uv.grib2"); // not exist System.out.printf("canWrite= %s%n", file.canWrite()); assert !file.canWrite(); }