Optimize dexdeps code.

It does too many small-sized byte reads, and so creates a huge number of
file I/Os even for relatively small dex files. Replacing them with
buffer-based solutions wherever possible greatly increases its
efficiency.

For example, CtsHiddenApiKillswitchDebugClassTestCases.apk previously
took 15+ secs, but now only 2.15 secs. Also this speeds up
cts-api-coverage runs from 15+ mins to 4+ mins.

Bug: 137407637
Test: Ran against some apks and diff the results.
Test: Ran cts-api-coverage, which scans 800+ apks with dexdeps.
Test: Compared before/after cts-api-coverage results.
Change-Id: I46393f9822b5e5516b9259695a84b4fa0fd722dd
1 file changed