Package org.yaml.snakeyaml.reader
Class StreamReader
- java.lang.Object
-
- org.yaml.snakeyaml.reader.StreamReader
-
public class StreamReader extends java.lang.Object
Reader: checks if code points are in allowed range. Returns '\0' when end of data has been reached.
-
-
Field Summary
Fields Modifier and Type Field Description private char[]
buffer
private static int
BUFFER_SIZE
private int
column
private int
dataLength
Real length of the data in dataWindowprivate int[]
dataWindow
Read data (as a moving window for input stream)private int
documentIndex
private boolean
eof
private int
index
private int
line
private java.lang.String
name
private int
pointer
The variable points to the current position in the data arrayprivate java.io.Reader
stream
-
Constructor Summary
Constructors Constructor Description StreamReader(java.io.Reader reader)
StreamReader(java.lang.String stream)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
ensureEnoughData()
private boolean
ensureEnoughData(int size)
void
forward()
void
forward(int length)
read the next length characters and move the pointer.int
getColumn()
int
getDocumentIndex()
Get the position of the current char in the current YAML documentint
getIndex()
int
getLine()
Mark
getMark()
static boolean
isPrintable(int c)
static boolean
isPrintable(java.lang.String data)
private void
moveIndices(int length)
int
peek()
int
peek(int index)
Peek the next index-th code pointjava.lang.String
prefix(int length)
peek the next length code pointsjava.lang.String
prefixForward(int length)
prefix(length) immediately followed by forward(length)void
resetDocumentIndex()
Reset the position to start (at the start of a new document in the stream)private void
update()
-
-
-
Field Detail
-
name
private java.lang.String name
-
stream
private final java.io.Reader stream
-
dataWindow
private int[] dataWindow
Read data (as a moving window for input stream)
-
dataLength
private int dataLength
Real length of the data in dataWindow
-
pointer
private int pointer
The variable points to the current position in the data array
-
eof
private boolean eof
-
index
private int index
-
documentIndex
private int documentIndex
-
line
private int line
-
column
private int column
-
buffer
private final char[] buffer
-
BUFFER_SIZE
private static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
isPrintable
public static boolean isPrintable(java.lang.String data)
-
isPrintable
public static boolean isPrintable(int c)
-
getMark
public Mark getMark()
-
forward
public void forward()
-
forward
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
- amount of characters to move forward
-
peek
public int peek()
-
peek
public int peek(int index)
Peek the next index-th code point- Parameters:
index
- to peek- Returns:
- the next index-th code point
-
prefix
public java.lang.String prefix(int length)
peek the next length code points- Parameters:
length
- amount of the characters to peek- Returns:
- the next length code points
-
prefixForward
public java.lang.String prefixForward(int length)
prefix(length) immediately followed by forward(length)- Parameters:
length
- amount of characters to get- Returns:
- the next length code points
-
ensureEnoughData
private boolean ensureEnoughData()
-
ensureEnoughData
private boolean ensureEnoughData(int size)
-
update
private void update()
-
getColumn
public int getColumn()
-
moveIndices
private void moveIndices(int length)
-
getDocumentIndex
public int getDocumentIndex()
Get the position of the current char in the current YAML document- Returns:
- index of the current position from the beginning of the current document
-
resetDocumentIndex
public void resetDocumentIndex()
Reset the position to start (at the start of a new document in the stream)
-
getIndex
public int getIndex()
- Returns:
- current position as number (in characters) from the beginning of the stream
-
getLine
public int getLine()
-
-