/** Permission checks to access file */
 private void checkAccess(UnixPath file, boolean checkRead, boolean checkWrite) {
   SecurityManager sm = System.getSecurityManager();
   if (sm != null) {
     if (checkRead) file.checkRead();
     if (checkWrite) file.checkWrite();
     sm.checkPermission(new RuntimePermission("accessUserInformation"));
   }
 }
コード例 #2
0
 @Override
 public BasicFileAttributes readAttributes() throws IOException {
   file.checkRead();
   try {
     UnixFileAttributes attrs = UnixFileAttributes.get(file, followLinks);
     return attrs.asBasicFileAttributes();
   } catch (UnixException x) {
     x.rethrowAsIOException(file);
     return null; // keep compiler happy
   }
 }