Top Description Fields Constructors Methods
org.snakeyaml.engine.v2.api

public Class YamlUnicodeReader

extends Reader
Class Inheritance
Imports
java.io.IOException, .InputStream, .InputStreamReader, .PushbackInputStream, .Reader, java.nio.charset.Charset, .CharsetDecoder, .CodingErrorAction, .StandardCharsets

Generic unicode textreader, which will use BOM mark to identify the encoding to be used. If BOM is not found then use a given default or system encoding.

Field Summary

Modifier and TypeField and Description
private static final int
pack-priv Charset
pack-priv PushbackInputStream
pack-priv InputStreamReader
private static final Charset
private static final Charset
private static final Charset
private static final Charset
private static final Charset
Inherited from java.io.Reader:
lock

Constructor Summary

AccessConstructor and Description
public
YamlUnicodeReader(InputStream
InputStream to be read
in
)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Closes the stream and releases any system resources associated with it.

public Charset

Returns:

the name of the character encoding being used by this stream.
getEncoding
()

Get stream encoding or NULL if stream is uninitialized.

protected void
init()

Read-ahead four bytes and check for BOM marks.

public int
read(char[] cbuf, int off, int len)

Implements abstract java.io.Reader.read.

Reads characters into a portion of an array.

Inherited from java.io.Reader:
markmarkSupportednullReaderofreadreadreadreadAllAsStringreadAllLinesreadyresetskiptransferTo

Field Detail

BOM_SIZEback to summary
private static final int BOM_SIZE
encodingback to summary
pack-priv Charset encoding
internalInback to summary
pack-priv PushbackInputStream internalIn
internalIn2back to summary
pack-priv InputStreamReader internalIn2
UTF16BEback to summary
private static final Charset UTF16BE
UTF16LEback to summary
private static final Charset UTF16LE
UTF32BEback to summary
private static final Charset UTF32BE
UTF32LEback to summary
private static final Charset UTF32LE
UTF8back to summary
private static final Charset UTF8

Constructor Detail

YamlUnicodeReaderback to summary
public YamlUnicodeReader(InputStream in)
Parameters
in:InputStream

InputStream to be read

Method Detail

closeback to summary
public void close() throws IOException

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Doc from java.io.Reader.close.

Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect.

Exceptions
IOException:
If an I/O error occurs
getEncodingback to summary
public Charset getEncoding()

Get stream encoding or NULL if stream is uninitialized. Call init() or read() method to initialize it.

Returns:Charset

the name of the character encoding being used by this stream.

initback to summary
protected void init() throws IOException

Read-ahead four bytes and check for BOM marks. Extra bytes are unread back to the stream, only BOM bytes are skipped.

Exceptions
IOException:
if InputStream cannot be created
readback to summary
public int read(char[] cbuf, int off, int len) throws IOException

Implements abstract java.io.Reader.read.

Doc from java.io.Reader.read.

Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

If len is zero, then no characters are read and 0 is returned; otherwise, there is an attempt to read at least one character. If no character is available because the stream is at its end, the value -1 is returned; otherwise, at least one character is read and stored into cbuf.

Exceptions
IOException:
If an I/O error occurs