欢迎光临散文网 会员登陆 & 注册

阅码场第1期:性能工程

2023-08-26 21:33 作者:bili_57619593086  | 我要投稿

列出文件和目录

File dir = new File("directoryName"); String[] children = dir.list(); if (children == null) {   // Either dir does not exist or is not a directory } else {   for (int i=0; i < children.length; i++) {     // Get filename of file or directory     String filename = children[i];   } } // It is also possible to filter the list of returned files. // This example does not return any files that start with `.'. FilenameFilter filter = new FilenameFilter() {   public boolean accept(File dir, String name) {     return !name.startsWith(".");   } };


阅码场第1期:性能工程的评论 (共 条)

分享到微博请遵守国家法律