Microsoft SDK for Java

setEncoding

This method of the XMLInputStream class defines the character encoding of the input stream.

Syntax

public void setEncoding(String encoding) throws IOException;

Parameters

encoding The type of character encoding. This can be one of the following formats:
  1. UTF-8

  2. Shift_JIS

  3. ISO-8859-1

  4. ISO-10646-UCS-4 (not yet supported)

  5. ISO-10646-UCS-2 or UCS-2

The default character encoding is ASCII.


Remarks

The character encoding must agree with the encoding determined by the constructor. The setEncoding method is used to clarify encodings that cannot be fully determined by reading the first four bytes in a stream. setEncoding is not used to change the encoding of a stream. It must be called within 4096 read() operations after the XMLInputStream object's creation.

Exceptions

IOException if the encoding type is not supported by the currently installed virtual machine.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.