Top Description Fields Constructors Methods
org.yaml.snakeyaml.reader

public Class StreamReader

extends Object
Class Inheritance
Imports
java.io.IOException, .Reader, .StringReader, java.util.Arrays, org.yaml.snakeyaml.error.Mark, .YAMLException, org.yaml.snakeyaml.scanner.Constant

Reader: checks if code points are in allowed range. Returns '\0' when end of data has been reached.

Field Summary

Modifier and TypeField and Description
private final char[]
private static final int
private int
private int
dataLength

Real length of the data in dataWindow

private int[]
dataWindow

Read data (as a moving window for input stream)

private int
private boolean
private int
private int
private String
private int
pointer

The variable points to the current position in the data array

private final Reader

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
private boolean
private boolean
ensureEnoughData(int size)

public void
public void
forward(int
amount of characters to move forward
length
)

read the next length characters and move the pointer.

public int
public int

Returns:

index of the current position from the beginning of the current document
getDocumentIndex
()

Get the position of the current char in the current YAML document

public int

Returns:

current position as number (in characters) from the beginning of the stream
getIndex
()

public int
public Mark
public static boolean
isPrintable(final String data)

public static boolean
isPrintable(final int c)

private void
moveIndices(int length)

public int
peek()

public int

Returns:

the next index-th code point
peek
(int
to peek
index
)

Peek the next index-th code point

public String

Returns:

the next length code points
prefix
(int
amount of the characters to peek
length
)

peek the next length code points

public String

Returns:

the next length code points
prefixForward
(int
amount of characters to get
length
)

prefix(length) immediately followed by forward(length)

public void
resetDocumentIndex()

Reset the position to start (at the start of a new document in the stream)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
private final char[] buffer
BUFFER_SIZEback to summary
private static final int BUFFER_SIZE
columnback to summary
private int column
dataLengthback to summary
private int dataLength

Real length of the data in dataWindow

dataWindowback to summary
private int[] dataWindow

Read data (as a moving window for input stream)

documentIndexback to summary
private int documentIndex
eofback to summary
private boolean eof
indexback to summary
private int index
lineback to summary
private int line
nameback to summary
private String name
pointerback to summary
private int pointer

The variable points to the current position in the data array

streamback to summary
private final Reader stream

Constructor Detail

StreamReaderback to summary
public StreamReader(String stream)
StreamReaderback to summary
public StreamReader(Reader reader)

Method Detail

ensureEnoughDataback to summary
private boolean ensureEnoughData()
ensureEnoughDataback to summary
private boolean ensureEnoughData(int size)
forwardback to summary
public void forward()
forwardback to summary
public void forward(int length)

read the next length characters and move the pointer. if the last character is high surrogate one more character will be read

Parameters
length:int

amount of characters to move forward

getColumnback to summary
public int getColumn()
getDocumentIndexback to summary
public int getDocumentIndex()

Get the position of the current char in the current YAML document

Returns:int

index of the current position from the beginning of the current document

getIndexback to summary
public int getIndex()
Returns:int

current position as number (in characters) from the beginning of the stream

getLineback to summary
public int getLine()
getMarkback to summary
public Mark getMark()
isPrintableback to summary
public static boolean isPrintable(final String data)
isPrintableback to summary
public static boolean isPrintable(final int c)
moveIndicesback to summary
private void moveIndices(int length)
peekback to summary
public int peek()
peekback to summary
public int peek(int index)

Peek the next index-th code point

Parameters
index:int

to peek

Returns:int

the next index-th code point

prefixback to summary
public String prefix(int length)

peek the next length code points

Parameters
length:int

amount of the characters to peek

Returns:String

the next length code points

prefixForwardback to summary
public String prefixForward(int length)

prefix(length) immediately followed by forward(length)

Parameters
length:int

amount of characters to get

Returns:String

the next length code points

resetDocumentIndexback to summary
public void resetDocumentIndex()

Reset the position to start (at the start of a new document in the stream)

updateback to summary
private void update()