Does your code take into account the file system allocation unit size?

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

03.11.2010 21:32 пользователь "Rob Truxler" <[email protected]> написал:

Hi folks.  I'm trying to manage the files that I store in a local cache. I
download files, then delete them after the total file size in the cache
exceeds a certain number of bytes.  What I'm shooting for right now is
something simple: setting the max cache size to be 1 MB, or 1*1024*1024
bytes = 1048576 bytes. I have a method that gets the cache directory, then
does a listFiles() on that File to get all children of the directory. I have
a flat cache structure, no subdirectories, so simply calling f.length() on
every child should give me my total cache size right?

Well what I'm finding is that the amount I count is about 0.9 of size
reported in Manage Applications > Application Info for my app, in the Cache
section.

Am I making a bad assumption that File.length() will actually return to me
the size, in bytes, of a file on disk? I also wonder also if disk space in
the Cache directory is being used by Android at all for some reason I'm
unaware of.

Any advice is good advice!
Thanks
Rob

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]<android-developers%[email protected]>
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to