Is there a way to retrieve the file path of an Android CacheResponse? Sure, one can get an InputStream, but in cases where some API (e.g. NDK code) expects a file path that does not help. Sure one can use this stream to produce another file, but that's more time and space.
Android CacheResponse: get file path?
76 views Asked by user6519354 At
2
There are 2 answers
0
On
I've run into this myself.
On Android (tested on Jellybean), the cache file path is the lowercase MD5-sum of the URI followed by
.1
So for the URL Android CacheResponse: get file path? the following files exists in the cache-directory.
- bf9b8f9a33062f084a70cba99dc79afe.0 - contains the headers of the HTTP response
- bf9b8f9a33062f084a70cba99dc79afe.1 - contains the body of the HTTP response
Ok, so pondering this a bit further (and poking at the code), I have to assume that response headers, etc, are in the same file -- not just the response body. If so, then there would clearly be no file path one could provide that was simply the response body. Confirmation would be helpful -- as would pointers to alternative HTTP caching libraries that would help here.