Listing and filtering directory content using Java NIO2

posted by anishaanisha 713 days, 22 hours, 35 minutes ago
Wednesday, August 08, 2012 9:35:10 PM GMT

The Files class provides a method- newDirectoryStream to get the Directory contents for a give path instance. There are other overloaded versions of newDirectoryStream method which take in filters to apply on the directory content. Listing all files in the directory Using Files.newDirectoryStream method gives an instance of DirectoryStream class which is a Iterable i.e one can get iterate over its contents. Also it implements AutoCloseable, Closeable which means that one can make use of try with resourc...

category: Java EE | clicked: 0 | | source: www.javabeat.net | show counter code
tags: directory, filtering, java NIO2, listing

To post comments using your Facebook,Twitter, Gmail etc credentials in the Discus comments section. Or use your Javapins credentials at the end of the page.
To post your comment as a Javapins user please login or signup to Javapins database.