java.io.File.isHidden()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(185)

本文整理了Java中java.io.File.isHidden()方法的一些代码示例,展示了File.isHidden()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。File.isHidden()方法的具体详情如下:
包路径:java.io.File
类名称:File
方法名:isHidden

File.isHidden介绍

[英]Returns whether or not this file is a hidden file as defined by the operating system. The notion of "hidden" is system-dependent. For Unix systems a file is considered hidden if its name starts with a ".". For Windows systems there is an explicit flag in the file system for this purpose.
[中]返回此文件是否为操作系统定义的隐藏文件。“隐藏”的概念取决于系统。对于Unix系统,如果文件名以“.”开头,则认为文件是隐藏的。对于Windows系统,文件系统中有一个明确的标志用于此目的。

代码示例

代码示例来源:origin: gocd/gocd

public static boolean isHidden(File file) {
  return file.isHidden() || file.getName().startsWith(".");
}

代码示例来源:origin: nutzam/nutz

public boolean accept(File f) {
    return !f.isHidden() && f.isDirectory() && !f.getName().startsWith(".");
  }
});

代码示例来源:origin: cSploit/android

public ArrayList<File> filter(File[] file_list, boolean onlyDirs, boolean showHidden){
 ArrayList<File> files = new ArrayList<File>();
 if(file_list != null){
  for(File file : file_list){
   if(onlyDirs && !file.isDirectory())
    continue;
   if(!showHidden && file.isHidden())
    continue;
   files.add(file);
  }
  Collections.sort(files);
 }
 return files;
}

代码示例来源:origin: nutzam/nutz

public boolean accept(File f) {
    return !f.isHidden() && f.isDirectory() && !f.getName().startsWith(".");
  }
});

代码示例来源:origin: h2oai/h2o-2

private void addFolder(File folder, ArrayList<File> filesInProgress ) {
 if( !folder.canRead() ) return;
 if (folder.isDirectory()) {
  for (File f: folder.listFiles()) {
   if( !f.canRead() ) continue; // Ignore unreadable files
   if( f.isHidden() && !folder.isHidden() )
    continue;             // Do not dive into hidden dirs unless asked
   if (f.isDirectory())
    addFolder(f,filesInProgress);
   else
    filesInProgress.add(f);
  }
 } else {
  filesInProgress.add(folder);
 }
}

代码示例来源:origin: nutzam/nutz

public boolean accept(File f) {
    return !f.isHidden()
        && f.isFile()
        && (null == suffix || f.getName().endsWith(suffix));
  }
});

代码示例来源:origin: nutzam/nutz

public boolean accept(File f) {
    if (f.isDirectory())
      return !f.isHidden() && !f.getName().startsWith(".");
    return f.getName().endsWith(".properties");
  }
});

代码示例来源:origin: Dreampie/Resty

public static List<File> files(File dir) {
  List<File> result = new ArrayList<File>();
  if (dir.exists()) {
   File[] files = dir.listFiles();
   if (files != null && files.length > 0) {
    for (File file : files) {
     if (!file.isHidden()) {
      if (file.isDirectory()) {
       result.addAll(files(new File(file.getAbsolutePath())));
      } else {
       result.add(file);
      }
     }
    }
   }
  }
  return result;
 }
}

代码示例来源:origin: azkaban/azkaban

@Override
 public boolean accept(final File pathname) {
  final String name = pathname.getName();
  return pathname.isFile() && !pathname.isHidden()
    && name.length() > this.suffix.length() && name.endsWith(this.suffix);
 }
}

代码示例来源:origin: apache/ignite

@Override public boolean accept(File f) {
    return !f.isHidden() && (f.isDirectory() || f.isFile() && f.getName().matches(ptrn));
  }
}

代码示例来源:origin: apache/flink

if (!file.exists() || file.isHidden() || file.isDirectory() || !file.isFile()) {
  HandlerUtils.sendErrorResponse(
    ctx,

代码示例来源:origin: azkaban/azkaban

@Override
 public boolean accept(final File pathname) {
  if (!pathname.isFile() || pathname.isHidden()) {
   return false;
  }
  final String name = pathname.getName();
  final int length = name.length();
  return this.suffix.length() <= length && this.prefix.length() <= length && name
    .startsWith(this.prefix) && name.endsWith(this.suffix);
 }
}

代码示例来源:origin: kiegroup/optaplanner

@Override
public boolean accept(File file) {
  if (file.isDirectory() || file.isHidden()) {
    return false;
  }
  return file.getName().endsWith(extensionWithDot);
}

代码示例来源:origin: rapidoid/rapidoid

if (!file.isFile() || file.isDirectory()) {
  return null;
  Log.debug("Loading resource file", "name", name, "file", file);
  this.lastModified = file.lastModified();
  this.hidden = file.isHidden();
  return IO.loadBytes(filename);

代码示例来源:origin: azkaban/azkaban

@Override
 public boolean accept(final File pathname) {
  if (!pathname.isFile() || pathname.isHidden()) {
   return false;
  }
  final String name = pathname.getName();
  final int length = name.length();
  if (this.suffix.length() > length || this.prefix.length() > length) {
   return false;
  }
  return name.startsWith(this.prefix) && name.endsWith(this.suffix);
 }
}

代码示例来源:origin: nutzam/nutz

public boolean accept(File f) {
  if (f.isDirectory()) {
    String fnm = f.getName().toLowerCase();
    // 忽略 SVN 和 CVS 文件,还有Git文件
    if (".svn".equals(fnm) || ".cvs".equals(fnm) || ".git".equals(fnm))
      return false;
    return true;
  }
  if (f.isHidden())
    return false;
  return pattern == null || pattern.matcher(f.getName()).find();
}

代码示例来源:origin: lets-blade/blade

if (file.isHidden() || !file.exists()) {
  if (resourcesDirectory.isDirectory()) {
    file = new File(resourcesDirectory.getPath() + "/" + cleanURL.substring(1));
    if (file.isHidden() || !file.exists()) {
      throw new NotFoundException(uri);
if (file.isDirectory() && showFileList) {
  sendListing(ctx, uri, getFileMetas(file), cleanURL);
  return;

代码示例来源:origin: gocd/gocd

public boolean accept(File file) {
  return !(file.isHidden() || isSerializedObjectFile(file.getName()));
}

代码示例来源:origin: nutzam/nutz

@Override
  public boolean accept(File f) {
    if (f.isDirectory())
      return deep;
    if (f.isHidden())
      return false;
    if (Strings.isEmpty(regex))
      return true;
    return f.getName().matches(regex);
  }
});

代码示例来源:origin: lets-blade/blade

if (file.isHidden() || !file.exists()) {
  if (resourcesDirectory.isDirectory()) {
    file = new File(resourcesDirectory.getPath() + "/" + cleanURL.substring(1));
    if (file.isHidden() || !file.exists()) {
      throw new NotFoundException(uri);
if (file.isDirectory() && showFileList) {
  sendListing(ctx, uri, getFileMetas(file), cleanURL);
  return;

相关文章