Package org.snakeyaml.engine.v2.scanner
Class StreamReader
- java.lang.Object
-
- org.snakeyaml.engine.v2.scanner.StreamReader
-
public final class StreamReader extends Object
Read the provided stream of code points into String and implement look-ahead operations. Checks if code points are in the allowed range.
-
-
Constructor Summary
Constructors Constructor Description StreamReader(Reader reader, LoadSettings loadSettings)Deprecated.use the other constructor with LoadSettings firstStreamReader(String stream, LoadSettings loadSettings)Deprecated.use the other constructor with LoadSettings firstStreamReader(LoadSettings loadSettings, Reader reader)CreateStreamReader(LoadSettings loadSettings, String stream)Create
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforward()read the next character and move the pointer.voidforward(int length)read the next length characters and move the pointer.intgetColumn()intgetDocumentIndex()Get the position of the currect char in the current YAML documentintgetIndex()intgetLine()Optional<Mark>getMark()GenerateMarkif it is configuredstatic booleanisPrintable(int c)Check if the code point is human-readablestatic booleanisPrintable(String data)Check if the all the data is human-readable (used in Representer)intpeek()Peek the next code point (look without moving the pointer)intpeek(int index)Peek the next index-th code pointStringprefix(int length)Create String from code pointsStringprefixForward(int length)prefix(length) immediately followed by forward(length)voidresetDocumentIndex()Reset the position to start (at the start of a new document in the stream)
-
-
-
Constructor Detail
-
StreamReader
@Deprecated public StreamReader(Reader reader, LoadSettings loadSettings)
Deprecated.use the other constructor with LoadSettings first- Parameters:
loadSettings- - configuration optionsreader- - the input
-
StreamReader
public StreamReader(LoadSettings loadSettings, Reader reader)
Create- Parameters:
loadSettings- - configuration optionsreader- - the input
-
StreamReader
@Deprecated public StreamReader(String stream, LoadSettings loadSettings)
Deprecated.use the other constructor with LoadSettings first- Parameters:
stream- - the inputloadSettings- - configuration options
-
StreamReader
public StreamReader(LoadSettings loadSettings, String stream)
Create- Parameters:
loadSettings- - configuration optionsstream- - the input
-
-
Method Detail
-
isPrintable
public static boolean isPrintable(String data)
Check if the all the data is human-readable (used in Representer)- Parameters:
data- - content to be checked for human-readability- Returns:
- true only when everything is human-readable
-
isPrintable
public static boolean isPrintable(int c)
Check if the code point is human-readable- Parameters:
c- - code point to be checked for human-readability- Returns:
- true only when the code point is human-readable
-
forward
public void forward()
read the next character and move the pointer. if the last character is high surrogate one more character will be read
-
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 the next code point (look without moving the pointer)- Returns:
- the next code point or 0 if empty
-
peek
public int peek(int index)
Peek the next index-th code point- Parameters:
index- to peek- Returns:
- the next index-th code point or 0 if empty
-
prefix
public String prefix(int length)
Create String from code points- Parameters:
length- amount of the characters to convert- Returns:
- the String representation
-
prefixForward
public String prefixForward(int length)
prefix(length) immediately followed by forward(length)- Parameters:
length- amount of characters to get- Returns:
- the next length code points
-
getColumn
public int getColumn()
- Returns:
- current position as number (in characters) from the beginning of the current line
-
getDocumentIndex
public int getDocumentIndex()
Get the position of the currect 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()
- Returns:
- current line from the beginning of the stream
-
-