code: public static void copyStream(InputStream is, OutputStream os, int bufferSize)
              throws IOException {
          if (is == null) {
              throw MESSAGES.nullArgument("input stream");
          }
          if (os == null) {
              throw MESSAGES.nullArgument("output stream");
          }
          byte[] buff = new byte[bufferSize];
          int rc;
          while ((rc = is.read(buff)) != -1) { os.write(buff, 0, rc); }
          os.flush();
      }
docs: Copy input stream to output stream without closing streams. Flushes output stream when done.
  
  @param is         input stream
  @param os         output stream
  @param bufferSize the buffer size to use
  @throws IOException for any error