docs: static Bitmap decodeStream(InputStream stream, int requestedWidth,
              int requestedHeight, final boolean canShrink,
              Bitmap possibleAlternative, boolean closeStream) {
          BitmapFactory.Options options = standardBitmapFactoryOptions();
  
          try {
              DecodeHelper helper;
              if (stream instanceof FileInputStream) {
                  helper = new DecodeFileStreamHelper((FileInputStream) stream);
              } else {
                  helper = new DecodeStreamHelper(stream);
              }
              helper.setInSampleSize(options, requestedWidth, requestedHeight);
  
              if (useAlternativeBitmap(possibleAlternative, options)) {
                  return possibleAlternative;
              }
  
              do {
                  try {
                      return helper.decode(options, requestedWidth,
                              requestedHeight);
                  } catch (OutOfMemoryError m) {
                      // Rewind stream to read again
                      helper.rewind();
                      options.inSampleSize *= 2; // try again, at half-size
                  }
              } while (canShrink);
  
          } catch (IOException e) {
              e.printStackTrace();
          } finally {
              if (options != null && options.inTempStorage != null) {
                  bufferBin.put(options.inTempStorage);
              }
  
              if (stream != null && closeStream) {
                  try {
                      stream.close();
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
              }
          }
  
          return null; // OutOfMemoryError, canShrink == false
      }