1

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.

DMH
  • 3,875
  • 2
  • 26
  • 25
user6519354
  • 169
  • 1
  • 7

2 Answers2

1

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
Community
  • 1
  • 1
0

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.

Jess Holle
  • 633
  • 5
  • 15