Search code examples
javafileionioglob

java.nio.Files, java.nio.Paths on java 6


I need to rewrite some java 7 file IO code that should run on a Java 6 VM too.

The implementation uses handy Java 7 features like autoclosing, Paths and Files.

To be more specific, I need to handle expressions like /tmp/foo/*.bar to return all .bar files (currently implemented with Files.newDirectoryStream(dir, glob)).

Does anyone know a handy library for this?


Solution

  • The Apache Ant API would be a good candidate for this, in particular their FileSet class might do the job.