Logo Search packages:      
Sourcecode: libgnucrypto-java version File versions  Download package

void gnu::crypto::key::OutgoingMessage::writeString ( String  s  )  throws KeyAgreementException [inline]

Encodes a string into the message.

s the string to encode.
KeyAgreementException if the UTF8 encoding is not supported on this platform, or if an encoding size constraint is violated.

Definition at line 192 of file OutgoingMessage.java.

References out.

      byte[] b = null;
      try {
         b = s.getBytes("UTF8");
      } catch (UnsupportedEncodingException x) {
         throw new KeyAgreementException("unxupported UTF8 encoding", x);
      int length = b.length;
      if (length > Registry.SASL_TWO_BYTE_MAX_LIMIT) {
         throw new KeyAgreementException("text too long");
      byte[] lengthBytes = { (byte)(length >>> 8), (byte) length };
      out.write(lengthBytes, 0, 2);
      out.write(b, 0, b.length);

Generated by  Doxygen 1.6.0   Back to index