Please refer to the image below and clarify me what is the root cause for this. While windows explorer shows correct file size, JFileChooser
shows wrong size.
I am telling file chooser is wrong because txt file is 0 byte file which I created, but file chooser shows 1kb for the same.
Asked
Active
Viewed 160 times
0

Andrew Thompson
- 168,117
- 40
- 217
- 433

Dilanka M
- 372
- 1
- 5
- 17
-
4*"windows explorer shows correct file size"* Actually it doesn't. Right click on the file and 'show details' for the correct size. – Andrew Thompson Oct 31 '16 at 06:50
-
yes, I did that as well, windows file properties shows it is 0 byte in both windows. – Dilanka M Oct 31 '16 at 06:56
-
1OK.. well the rest can be explained by 'rounding differences' in the last digit of '# of K'. This is fussing over trivialities. – Andrew Thompson Oct 31 '16 at 06:58
1 Answers
1
Notice that the size of the same file in each of the two listings differs by 1 KB. Windows includes the file's metadata, like they talk about here, but JFileChooser
includes just the length()
of the file's content.

Catalina Island
- 7,027
- 2
- 23
- 42