📄 filemanager.java
字号:
/* * Description : File manager to update directory and file listing. * * Notes : * * LICENSE : This code is licensed under GPL. (See http://www.gnu.org/copyleft/gpl.html) * * fileManager.java @version 1.0 * Created on May 3, 2005 * */package btServer;import java.io.File;public class fileManager { private String fileList[]; private String filePath; private int fileCount; public fileManager() { // Get directory listing filePath = System.getProperty("user.dir"); filePath = filePath.concat(File.separator); filePath = filePath.concat("files"); File temp = new File(filePath); fileList = temp.list(); fileCount = 0; for (int i = 0; i < fileList.length; i++){ temp = new File(filePath + File.separator + fileList[i]); if (temp.isFile()) { fileList[fileCount] = fileList[i]; fileCount++; } } } public String[] getFileList(){ return fileList; } public String getFilePath() { return filePath; } public int getFileCount(){ return fileCount; } /* * Testing only */ public static void main(String[] args) { fileManager fm1 = new fileManager(); System.out.println(fm1.getFileCount()); for (int i = 0; i < fm1.getFileCount() ;i++ ){ System.out.println(fm1.getFileList()[i]); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -