怎样获取java新IO的Path文件大小

阅读 183

2022-08-18

import org.junit.Test;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class TestFileSize {
@Test
public void getSize() throws IOException {
Path file = Paths.get("F:\\logs\\spider.log");
long length = Files.size(file);
System.out.printf("文件大小:%d byte",length);
}
}

怎样获取java新IO的Path文件大小_文件大小

 

精彩评论(0)

0 0 举报