/** * Deletes the file at the given absolute path. */ public void deleteFile(JimfsPath path, DeleteMode deleteMode) throws IOException { store.writeLock().lock(); try { DirectoryEntry entry = lookUp(path, Options.NOFOLLOW_LINKS).requireExists(path); delete(entry, deleteMode, path); } finally { store.writeLock().unlock(); } }
/** * Gets or creates a new regular file with a write lock (assuming the file does not exist). */ private RegularFile getOrCreateRegularFileWithWriteLock( JimfsPath path, Set<OpenOption> options, FileAttribute<?>[] attrs) throws IOException { store.writeLock().lock(); try { File file = createFile(path, store.regularFileCreator(), options.contains(CREATE_NEW), attrs); // the file already existed but was not a regular file if (!file.isRegularFile()) { throw new FileSystemException(path.toString(), null, "not a regular file"); } return open((RegularFile) file, options); } finally { store.writeLock().unlock(); } }
/** * Deletes the file at the given absolute path. */ public void deleteFile(JimfsPath path, DeleteMode deleteMode) throws IOException { store.writeLock().lock(); try { DirectoryEntry entry = lookUp(path, Options.NOFOLLOW_LINKS).requireExists(path); delete(entry, deleteMode, path); } finally { store.writeLock().unlock(); } }
/** * Gets or creates a new regular file with a write lock (assuming the file does not exist). */ private RegularFile getOrCreateRegularFileWithWriteLock( JimfsPath path, Set<OpenOption> options, FileAttribute<?>[] attrs) throws IOException { store.writeLock().lock(); try { File file = createFile(path, store.regularFileCreator(), options.contains(CREATE_NEW), attrs); // the file already existed but was not a regular file if (!file.isRegularFile()) { throw new FileSystemException(path.toString(), null, "not a regular file"); } return open((RegularFile) file, options); } finally { store.writeLock().unlock(); } }