导航:首页 > 编程语言 > java打印路径

java打印路径

发布时间:2024-01-14 01:23:36

❶ Java 编写一个程序 实现输出一个给定目录中的全部文件的路径

读取文件夹下所有文件及文件夹用.list()就可以,返回文件名包括后缀名。
至于文件大小你试试这个:

public void File(String oldPath, String newPath) { //复制文件
//System.out.println(oldPath+"***"+newPath);
try {
//int bytesum = 0;
int byteread = 0;

InputStream inStream = new FileInputStream(oldPath); // 读入原文件
FileOutputStream fs = new FileOutputStream(newPath);
byte[] buffer = new byte[1024]; //每次取用的大小
while ((byteread = inStream.read(buffer)) != -1) {
//bytesum += byteread; // 字节数 文件大小
//System.out.println(bytesum);
fs.write(buffer, 0, byteread);
}
inStream.close();

}catch (Exception e) {
System.out.println(" file error");
e.printStackTrace();
}
}
把注释去了,里面的bytesum就是文件大小。

阅读全文

与java打印路径相关的资料

热点内容
如何自己编译android系统 浏览:786
phpmysqlpdomysqli 浏览:802
php修改sql语句 浏览:714
android有道api 浏览:381
挠耳营水表用的什么app 浏览:49
战锤40kpdf 浏览:375
java判断字符串是汉字 浏览:462
2017初级教材pdf 浏览:451
松下空调压缩机品牌 浏览:817
python复选框 浏览:748
反诈中心app是什么时候出来的 浏览:586
魔兽世界需要什么服务器地址 浏览:189
啥是单片机休眠 浏览:104
什么音乐app最好 浏览:929
牙膏自制解压神器 浏览:329
卸载linuxwps 浏览:228
threadjavarunnable 浏览:360
一元线性回归计算法 浏览:950
刷宝app是什么鬼 浏览:744
linux动态加载模块 浏览:25