Fix crash/OOM in DiskBasedCache

DiskBasedCache.writeHeader() can throw an IOException and swallow it. This causes the
cache entry to be partially written followed by the entry's data. When reading back,
it is possible to read back the data segment (garbled part) when attempting to parse
the cache header.

Change-Id: I3022ca1566bc60e5869bb4ec384c866b4ba5c1c5
Improve DiskBasedCache initial scan performance

Using a BufferedInputStream significantly reduces the time it takes
to initialize the cache. On my Nexus 5 with ~330 files in cache init
time went from ~2s to ~0.5s with this change.

Change-Id: I3dd909e3235583306ff5943f69e3947a275bf968
Signed-off-by: Fabian Frank <fabian.frank.de@gmail.com>
Add a public accessor for a Request's ErrorListener.

Add a public accessor for a Request's ErrorListener.

Change-Id: Ifd3b8f818dd0e9db0183f08321043aae7c92c72c
Signed-off-by: Shirish Kalele <kalele@google.com>