Alright, well I think I'm being too much of a perfectionist here, because
what I have is at least an approximation that works.
Thanks for your responses.

On Wed, Nov 3, 2010 at 3:39 PM, DanH <[email protected]> wrote:

> The file size will be rounded up to the "sector" size of the storage
> medium.  I don't offhand know how you find that value. (Could be
> anywhere from 256 to 16K.)  And there is the overhead in the directory
> itself for storage of the file name and other file info -- probably on
> the order of file_name_length (maybe times 2) plus 64 bytes.  Don't
> know whether this is factored into the cache size or not.
>
> On Nov 3, 1:31 pm, Rob Truxler <[email protected]> wrote:
> > 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