怎么从源代码中 学会 使用 java中的exists

云原生 发布于 2014/08/25 11:22
阅读 374
收藏 0


    /**
     * Tests whether the file or directory denoted by this abstract pathname
     * exists.
     *
     * @return  <code>true</code> if and only if the file or directory denoted
     *          by this abstract pathname exists; <code>false</code> otherwise
     *
     * @throws  SecurityException
     *          If a security manager exists and its <code>{ @link
     *          java.lang.SecurityManager#checkRead(java.lang.String)}</code>
     *          method denies read access to the file or directory
     */
    public boolean exists() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
   security.checkRead(path);
}
return ((fs.getBooleanAttributes(this) & FileSystem.BA_EXISTS) != 0);
    }
加载中
返回顶部
顶部