FileSystemProvider example....

Tom Lasseter t.lasseter at comcast.net
Mon Jun 25 20:18:23 PDT 2012


 

 

The new Java 7 FileSystem is very cool..just what I need.but for the life of
me I can't create a custom FileSystemProvider.  There must be an example
somewhere!  There is only the ZipFileSystemProvider.  I want to create a new
FileSystem on either my local system or on a remote system.  

 

The simplest case is given the local system as the
DefaultFileSystemProvider, I want a new FileSystem from it rooted at some
arbitrary path, like c:/FileSystems/myFileSystem.  What could be easier than
that given the technology being provided.  I would think that this would do
it:

 

Map<String, String> env = new HashMap<>();

env.put("create", "true");

Path path = Paths.get("c:/FileSystems/myFileSystem");

FileSystem fileSystem = null;

try

{

fileSystem = fileSystemProvider.newFileSystem(path, env);

}

catch(Exception e)

{

               e.printStackTrace();

}

 

Help would be appreciated.  

 

Thanks and regards,

 

Tom

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20120625/801d1366/attachment.html 


More information about the nio-dev mailing list