Reputation: 5540
We are building a new Java 7 NIO.2 FileSystemProvider, and would like to not exclude Java 6 users. Is there any good strategy for supporting Java 6 users? Is it better to build something compatible with Java 6 and then build the new API on top?
Upvotes: 2
Views: 248
Reputation: 3381
Instead of using the Java 7 api, you may take in consideration the Apache VFS project which can be used on the Java 6 platform.
http://commons.apache.org/proper/commons-vfs/
Upvotes: 0
Reputation: 328624
That depends on which features you use. NIO2 has some features which you simply can't replicate in Java 6.
But to way to go is to create an interface which contains the functionality that you need and then write two implementations. At runtime, you can then check the Java version and use reflection to instantiate the correct one.
Upvotes: 3