code: private static void copyStream(InputStream is, OutputStream os, int bufferSize)
              throws IOException {
          Assert.checkNotNullParam("is", is);
          Assert.checkNotNullParam("os", os);
          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