docs: public static void write( InputStream input,
                                OutputStream stream,
                                int bufferSize ) throws IOException {
          CheckArg.isNotNull(stream, "destination stream");
          CheckArg.isPositive(bufferSize, "bufferSize");
          boolean error = false;
          try {
              if (input != null) {
                  byte[] buffer = new byte[bufferSize];
                  try {
                      int numRead = 0;
                      while ((numRead = input.read(buffer)) > -1) {
                          stream.write(buffer, 0, numRead);
                      }
                  } finally {
                      input.close();
                  }
              }
          } catch (IOException e) {
              error = true; // this error should be thrown, even if there is an error flushing/closing stream
              throw e;
          } catch (RuntimeException e) {
              error = true; // this error should be thrown, even if there is an error flushing/closing stream
              throw e;
          } finally {
              try {
                  stream.flush();
              } catch (IOException e) {
                  if (!error) throw e;
              } finally {
                  try {
                      stream.close();
                  } catch (IOException e) {
                      if (!error) throw e;
                  }
              }
          }
      }