File file1 = new File("D:\\logs\\serviceone\\s1.log");
FileInputStream fis = null;
if(file1.exists()){
try {
fis = new FileInputStream(file1);
System.out.println((double)(fis.available()/1024/1024)+"M");
} catch (FileNotFoundException e) {
} catch (IOException e) {
}finally{
try {
fis.close();
} catch (IOException e) {
}
}
}
File类学习
最新推荐文章于 2022-06-16 18:01:12 发布