RandomAccessFile.writeUTF

RandomAccessFile.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 file using UTF-8 encoding in a machine-independent manner.

First, two bytes are written to the file 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 each character.

Exceptions
IOException if an I/O error occurs.