code: public static int copy(InputStream is, OutputStream os, boolean closeOs) {
          if (closeOs) {
              return write(is).ensureCloseSink().to(os);
          } else {
              return write(is).to(os);
          }
      }
docs: Copy an stream to another one. It close the input stream anyway.
  
  If the param closeOs is true then close the output stream.
  
  @param is
  input stream
  @param os
  output stream
  @param closeOs
  specify whether it shall close output stream after operation
  @return number of bytes copied