public static FileInputStream getFileIputStream(final File file) throws FileNotFoundException {
        try {
            return AccessController.doPrivileged(
                                                 new PrivilegedExceptionAction<FileInputStream>() {
                                                     @Override
                                                     public FileInputStream run() throws FileNotFoundException {
                                                         return new FileInputStream(file);
                                                     }
                                                 });
        } catch (PrivilegedActionException e) {
            // Creating a FileOutputStream can only return a FileNotFoundException
            throw (FileNotFoundException) e.getCause();
        }
    }
public static FileInputStream getFileIputStream ( final File file ) throws FileNotFoundException { try { return AccessController . doPrivileged ( new PrivilegedExceptionAction < FileInputStream > ( ) { @ Override public FileInputStream run ( ) throws FileNotFoundException { return new FileInputStream ( file ) ; } } ) ; } catch ( PrivilegedActionException e ) { throw ( FileNotFoundException ) e . getCause ( ) ; } }
Java 2 security APIs for FileInputStream