s
. If s
is null
, a NullPointerException
is thrown. Each character in the string s
is converted to a group of one, two, or three bytes, depending on the value of the character. If a character c
is in the range \u0001
through \u007f
, it is represented by one byte:
(byte)c
If a character c
is \u0000
or is in the range \u0080
through \u07ff
, then it is represented by two bytes, to be written in the order shown:
(byte)(0xc0 | (0x1f & (c >> 6))) (byte)(0x80 | (0x3f & c))
If a character c
is in the range \u0800
through uffff
, then it is represented by three bytes, to be written in the order shown:
(byte)(0xe0 | (0x0f & (c >> 12))) (byte)(0x80 | (0x3f & (c >> 6))) (byte)(0x80 | (0x3f & c))
First, the total number of bytes needed to represent all the characters of s
is calculated. If this number is larger than 65535
, then a UTFDataFormatException
is thrown. Otherwise, this length is written to the output stream in exactly the manner of the writeShort
method; after this, the one-, two-, or three-byte representation of each character in the string s
is written.
The bytes written by this method may be read by the readUTF
method of interface DataInput
, which will then return a String
equal to s
.
@param s the string value to be written.
@throws IOException if an I/O error occurs.
value
) in UTF format into the receiver's underlying stream.
@param value The primitive data to write
@throws IOException If an IO exception happened when writing the primitive data.
For more information on the UTF-8 format, see "File System Safe UCS Transformation Format (FSS_UTF)", X/Open Preliminary Specification, X/Open Company Ltd., Document Number: P316. This information also appears in ISO/IEC 10646, Annex P.
@param value the String
value to be written
@throws JMSException if the JMS provider fails to write the message due to some internal error.
@throws MessageNotWriteableException if the message is in read-only mode.
For more information on the UTF-8 format, see "File System Safe UCS Transformation Format (FSS_UTF)", X/Open Preliminary Specification, X/Open Company Ltd., Document Number: P316. This information also appears in ISO/IEC 10646, Annex P.
@param value the String
value to be written
@throws JMSException if the JMS provider fails to write the message dueto some internal error.
@throws MessageNotWriteableException if the message is in read-only mode.
For more information on the UTF-8 format, see "File System Safe UCS Transformation Format (FSS_UTF)", X/Open Preliminary Specification, X/Open Company Ltd., Document Number: P316. This information also appears in ISO/IEC 10646, Annex P.
@param value the String
value to be written
@throws JMSException if the JMS provider fails to write the message due to some internal error.
@throws MessageNotWriteableException if the message is in read-only mode.
DataOutput
. The string is encoded in unmodified UTF-8.
Its encoding includes the size of the string so that it can be read from a {@link DataInput}without the need to specify its size. @param value the string to write. Empty string and null are also allowed.
|
|
|
|
|
|