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);
    }
}

 

posted on 2019-09-05 08:58  你不知道的浪漫  阅读(496)  评论(0)    收藏  举报