Rewrite the app art caching and fetching (again!) to finally address OOM problems and speed up art loading

This commit is contained in:
Cameron Gutman
2015-02-27 01:16:06 -05:00
parent 194037ff41
commit 80d8c5953e
8 changed files with 98 additions and 128 deletions

View File

@@ -38,6 +38,15 @@ public class CacheHelper {
return new BufferedOutputStream(new FileOutputStream(openPath(true, root, path)));
}
public static void writeInputStreamToOutputStream(InputStream in, OutputStream out) throws IOException {
byte[] buf = new byte[4096];
int bytesRead;
while ((bytesRead = in.read(buf)) != -1) {
out.write(buf, 0, bytesRead);
}
}
public static String readInputStreamToString(InputStream in) throws IOException {
Reader r = new InputStreamReader(in);