File openExistingFile(@NotNull final String name, final boolean throwFileNotFound) { final File result = vfs.openFile(env.getAndCheckCurrentTransaction(), name, false); if (throwFileNotFound && result == null) { throw new FileNotFoundException(name); } return result; }
@Override public String[] listAll() throws IOException { final Transaction txn = env.getAndCheckCurrentTransaction(); final ArrayList<String> allFiles = new ArrayList<>((int) vfs.getNumberOfFiles(txn)); for (final File file : vfs.getFiles(txn)) { allFiles.add(file.getPath()); } return allFiles.toArray(new String[allFiles.size()]); }
@Override public long fileLength(String name) throws IOException { return vfs.getFileLength(env.getAndCheckCurrentTransaction(), openExistingFile(name, true)); }
@Override public void deleteFile(String name) throws IOException { vfs.deleteFile(env.getAndCheckCurrentTransaction(), name); }
@Override public void touchFile(String name) throws IOException { vfs.touchFile(env.getAndCheckCurrentTransaction(), openExistingFile(name, true)); }