@Override public FileSystem newFileSystem( final URI uri, final Map<String, ?> env, final FileSystemType type ) throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException, IOException, SecurityException { try { final FileSystem fs = FileSystems.newFileSystem( uri, env ); return registerFS( fs, type ); } catch ( final FileSystemAlreadyExistsException ex ) { registerFS( FileSystems.getFileSystem( uri ), type ); throw ex; } }
/** * @throws IllegalArgumentException * @throws ProviderNotFoundException * @throws ServiceConfigurationError * @throws IOException * @throws SecurityException * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html#newFileSystem(java.nio.file.Path, java.lang.ClassLoader)">Original JavaDoc</a> */ public static FileSystem newFileSystem(final Path path, final ClassLoader loader) throws IllegalArgumentException, ProviderNotFoundException, ServiceConfigurationError, IOException, SecurityException { checkNotNull("path", path); final Map<String, ?> env = emptyMap(); return newFileSystem(path.toUri(), env, null); }
@Override public FileSystem getFileSystem( final URI uri ) { try { return registerFS( FileSystems.getFileSystem( uri ), DEFAULT_FS_TYPE ); } catch ( final Exception ex ) { return null; } }
/** * @throws IllegalArgumentException * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html#get(java.lang.String, java.lang.String...)">JDK JavaDoc</a> */ public static Path get(final String first, final String... more) throws IllegalArgumentException { checkNotNull("first", first); if (first.trim().length() == 0) { return FileSystems.getDefault().getPath(first); } URI uri = null; if (more == null || more.length == 0) { try { uri = new URI(first); } catch (URISyntaxException ex) { try { uri = URI.create(first); } catch (IllegalArgumentException e) { uri = null; } } } if (uri != null && uri.getScheme() != null) { return get(uri); } return FileSystems.getDefault().getPath(first, more); }
/** * @throws IllegalArgumentException * @throws FileSystemAlreadyExistsException * @throws ProviderNotFoundException * @throws IOException * @throws SecurityException * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html#newFileSystem(java.net.URI, java.util.Map)">Original JavaDoc</a> */ public static FileSystem newFileSystem(final URI uri, final Map<String, ?> env) throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException, IOException, SecurityException { checkNotNull("uri", uri); checkNotNull("env", env); return newFileSystem(uri, env, null); }