docs: public static byte[] readFully(InputStream in, boolean closeInputStream) throws IOException {
  
          if (in instanceof ByteArrayInputStream) {
              // content can be read in one pass
              return readFully(in, in.available(), closeInputStream);
          }
  
          // copy buffer
          byte[] xfer = new byte[2048];
          // output buffer
          ByteArrayOutputStream out = new ByteArrayOutputStream(xfer.length);
  
          // transfer data from input to output in xfer-sized chunks.
          for (int bytesRead = in.read(xfer, 0, xfer.length); bytesRead >= 0; bytesRead = in.read(xfer, 0, xfer.length)) {
              if (bytesRead > 0) {
                  out.write(xfer, 0, bytesRead);
              }
          }
          if (closeInputStream) {
              in.close();
          }
          out.close();
          return out.toByteArray();
      }