I've read that wrapping a BufferedInputStream around an input stream is only of benefit if you're reading the input stream in small chunks. Otherwise, using it may actually have adverse effects.
What is the situation when the input stream is bitmap data fetched with HttpURLConnection (or your favourite networking library, e.g. OkHttp)... is it a help or a hindrance?
I'm wondering not only in terms of overall time/speed, but also in terms of resiliency... would using a buffer help at all with flaky network conditions where the connection is dropping in and out?
boolean useBufferedInputStream = true; // <--- true or false?
URL url = new URL("https://example.com/my_bitmap.png");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
InputStream inputStream;
if (useBufferedInputStream) {
inputStream = new BufferedInputStream(connection.getInputStream());
} else {
inputStream = connection.getInputStream();
}
Bitmap bmp = BitmapFactory.decodeStream(inputStream);