• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to check file size on disk

 
scott Edwards
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to check the size that a file occupies on disk, not the actual file size.
Could somebody please help me out?
Thanks a lot.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Meaning the size of the allocation blocks dedicated to the file, I presume.
I don't think there's any way to do this from Java.
 
scott Edwards
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I mean
the size of the allocation blocks dedicated to the file.
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Java there is nothing to do with hadware or Operating System. You can only find the No. of bytes in a File not in terms of disk space.
The only way is to write Operating System Specific code (in C Language)to find out the file size and access the code using JNI from Java.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic