/** * Returns the file system state. */ public FileSystemState state() { return store.state(); }
@Override public ImmutableSet<FileStore> getFileStores() { fileStore.state().checkOpen(); return ImmutableSet.<FileStore>of(fileStore); }
@Override public void close() throws IOException { fileStore.state().close(); } }
@Override public UserPrincipalLookupService getUserPrincipalLookupService() { fileStore.state().checkOpen(); return userLookupService; }
@Override public boolean isOpen() { return fileStore.state().isOpen(); }
/** * Returns a default thread pool to use for asynchronous file channels when users do not provide * an executor themselves. (This is required by the spec of newAsynchronousFileChannel in * FileSystemProvider.) */ public synchronized ExecutorService getDefaultThreadPool() { if (defaultThreadPool == null) { defaultThreadPool = Executors.newCachedThreadPool( new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("JimfsFileSystem-" + uri.getHost() + "-defaultThreadPool-%s") .build()); // ensure thread pool is closed when file system is closed fileStore .state() .register( new Closeable() { @Override public void close() { defaultThreadPool.shutdown(); } }); } return defaultThreadPool; }
@Override public PathMatcher getPathMatcher(String syntaxAndPattern) { fileStore.state().checkOpen(); return pathService.createPathMatcher(syntaxAndPattern); }
@Override public JimfsPath getPath(String first, String... more) { fileStore.state().checkOpen(); return pathService.parsePath(first, more); }
/** * Converts the given URI into a path in this file system. */ public JimfsPath toPath(URI uri) { fileStore.state().checkOpen(); return pathService.fromUri(uri); }
/** * Gets the URI of the given path in this file system. */ public URI toUri(JimfsPath path) { fileStore.state().checkOpen(); return pathService.toUri(uri, path.toAbsolutePath()); }
/** * Returns the file system state. */ public FileSystemState state() { return store.state(); }
@Override public ImmutableSet<FileStore> getFileStores() { fileStore.state().checkOpen(); return ImmutableSet.<FileStore>of(fileStore); }
@Override public void close() throws IOException { fileStore.state().close(); } }
@Override public UserPrincipalLookupService getUserPrincipalLookupService() { fileStore.state().checkOpen(); return userLookupService; }
@Override public boolean isOpen() { return fileStore.state().isOpen(); }
/** * Returns a default thread pool to use for asynchronous file channels when users do not provide * an executor themselves. (This is required by the spec of newAsynchronousFileChannel in * FileSystemProvider.) */ public synchronized ExecutorService getDefaultThreadPool() { if (defaultThreadPool == null) { defaultThreadPool = Executors.newCachedThreadPool( new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("JimfsFileSystem-" + uri.getHost() + "-defaultThreadPool-%s") .build()); // ensure thread pool is closed when file system is closed fileStore .state() .register( new Closeable() { @Override public void close() { defaultThreadPool.shutdown(); } }); } return defaultThreadPool; }
/** * Converts the given URI into a path in this file system. */ public JimfsPath toPath(URI uri) { fileStore.state().checkOpen(); return pathService.fromUri(uri); }
@Override public PathMatcher getPathMatcher(String syntaxAndPattern) { fileStore.state().checkOpen(); return pathService.createPathMatcher(syntaxAndPattern); }
@Override public JimfsPath getPath(String first, String... more) { fileStore.state().checkOpen(); return pathService.parsePath(first, more); }
/** * Gets the URI of the given path in this file system. */ public URI toUri(JimfsPath path) { fileStore.state().checkOpen(); return pathService.toUri(uri, path.toAbsolutePath()); }