Re: How to Manage Metadata in Java?
If you want to determine whether a file is a regular file that can be executed (and not a directory), the example provided by 'MELTRONICS' is extended to check the file type by using the basic file attributes. The following is the sample of coding :
Code:
import static java.nio.file.AccessMode.*;
Path file = .....give your path file here....;
boolean error=false;
try {
file.checkAccess(READ, EXECUTE);
if (!Attributes.readFileAttributes(file).isRegularFile()) {
error = true;
}
} catch (IOException x) {
error = true;
}
if (error) {
return;
}
Last edited by Solitario; 19-02-2010 at 03:40 AM.
I do to dead flowers what people at morgues do to dead people. Suck all the moisture out, dip them in plastic, paint them up pretty and put them in a nice frame.
Bookmarks