code: public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
          byte b[] = getBytes();
          PdfEncryption crypto = null;
          if (writer != null)
              crypto = writer.getEncryption();
          if (crypto != null && !crypto.isEmbeddedFilesOnly())
              b = crypto.encryptByteArray(b);
          if (hexWriting) {
              ByteBuffer buf = new ByteBuffer();
              buf.append('<');
              int len = b.length;
              for (int k = 0; k < len; ++k)
                  buf.appendHex(b[k]);
              buf.append('>');
              os.write(buf.toByteArray());
          }
          else
              os.write(PdfContentByte.escapeString(b));
      }
docs: Writes the PDF representation of this <CODE>PdfString</CODE> as an array
  of <CODE>byte</CODE> to the specified <CODE>OutputStream</CODE>.
  
  @param writer for backwards compatibility
  @param os The <CODE>OutputStream</CODE> to write the bytes to.