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文件大小

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-04
  • 2021-08-12
  • 2021-09-22
  • 2021-10-08
  • 2022-02-10
  • 2021-12-12
猜你喜欢
  • 2021-12-08
  • 2022-12-23
  • 2021-08-20
  • 2022-02-17
  • 2021-06-03
  • 2022-12-23
相关资源
相似解决方案