Search code examples
javafilesystemsocpjp

FileSystem vs FileSystems what is the relation between them? (Java)


What's the relation between those 2 class? More in detail, how can I use the getPathMatcher method in the FileSystem class? Anybody can give me a some clarity between those 2 classes? Thanks in advance indeed.


Solution

  • Well as the Javadoc says:

    FileSystems provides

    Factory methods for file systems.

    Please provide more detail what you have done and what issues you have with getPathMatcher.

    http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html

    How can I use getPathMatcher? It is abstract, should I implement it?

    No, you only have to implement it if you want to write your own FileSystem. If you're using an object provided by the FileSystems factory, the class of that object must have implemented all abstract methods already, otherwise no object could have been created.