DataOutputStream.writeUTF

DataOutputStream.writeUTF

Class Overview | Class Members | This Package | All Packages

Syntax
public final void writeUTF( String str ) throws IOException
Parameters
str
a string to be written.
Description
Writes a string to the underlying output stream using UTF-8 encoding in a machine-independent manner.

First, two bytes are written to the output stream as if by the writeShort method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the UTF-8 encoding for the character.

Exceptions
IOException if an I/O error occurs.