code: private void copyToStream(String txt, OutputStream stream) throws IOException {
          if (txt != null) {
              stream.write(txt.getBytes());
          }
      }
docs: Copy character sequence to outbput stream.
  @param txt
  @param stream
  @throws IOException