code: private static void __flush(InputStream is, OutputStream os, int bufferSize) throws IOException {
          byte[] buffer = new byte[bufferSize];
  
          for (int length = 0; (length = is.read(buffer)) > 0;) {
              os.write(buffer, 0, length);
          }
      }
docs: buffer of given size