Top Description Fields Constructors Methods
jdk.internal.util.xml.impl

public Class ReaderUTF8

extends Reader
Class Inheritance
Imports
java.io.Reader, .InputStream, .IOException, .UnsupportedEncodingException

UTF-8 transformed UCS-2 character stream reader. This reader converts UTF-8 transformed UCS-2 characters to Java characters. The UCS-2 subset of UTF-8 transformation is described in RFC-2279 #2 "UTF-8 definition": 0000 0000-0000 007F 0xxxxxxx 0000 0080-0000 07FF 110xxxxx 10xxxxxx 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx This reader will return incorrect last character on broken UTF-8 stream.

Field Summary

Modifier and TypeField and Description
private InputStream
Inherited from java.io.Reader:
lock

Constructor Summary

AccessConstructor and Description
public
ReaderUTF8(InputStream
A byte input stream.
is
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Closes the stream.

public int
read(char[]
Destination buffer.
cbuf
,
int
Offset at which to start storing characters.
off
,
int
Maximum number of characters to read.
len
)

Implements abstract java.io.Reader.read.

Reads characters into a portion of an array.

public int

Returns:

The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached.
read
()

Overrides java.io.Reader.read.

Reads a single character.

Inherited from java.io.Reader:
markmarkSupportednullReaderreadreadreadyresetskiptransferTo

Field Detail

isback to summary
private InputStream is

Constructor Detail

ReaderUTF8back to summary
public ReaderUTF8(InputStream is)

Constructor.

Parameters
is:InputStream

A byte input stream.

Method Detail

closeback to summary
public void close() throws IOException

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Closes the stream.

Exceptions
IOException:
If any IO errors occur.
readback to summary
public int read(char[] cbuf, int off, int len) throws IOException

Implements abstract java.io.Reader.read.

Reads characters into a portion of an array.

Parameters
cbuf:char[]

Destination buffer.

off:int

Offset at which to start storing characters.

len:int

Maximum number of characters to read.

Returns:int

Doc from java.io.Reader.read.

The number of characters read, or -1 if the end of the stream has been reached

Exceptions
IOException:
If any IO errors occur.
UnsupportedEncodingException:
If UCS-4 character occur in the stream.
readback to summary
public int read() throws IOException

Overrides java.io.Reader.read.

Reads a single character.

Returns:int

The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached.

Exceptions
IOException:
If any IO errors occur.
UnsupportedEncodingException:
If UCS-4 character occur in the stream.