How do I get files on disk, not just the file size in Java?
•
Java
I need the file size on the disk, not the file size
File myFile = new File ("C:\\Send\\Capture.png"); System.out.println((int)myFile.length());
^This code gives the file size I need the file size on the disk They are always different, as shown in the figure below, right?
Solution
Look at link
The answer is c# provided, but because it uses Win32 API functions, you can easily convert it to Java The function used to get the disk size is getcompressedfilesize
Hope to help
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码