Package org.jsoup.parser
Class CharacterReader
java.lang.Object
org.jsoup.parser.CharacterReader
public final class CharacterReader extends Object
CharacterReader consumes tokens off a string. Used internally by jsoup. API subject to changes.
-
Constructor Summary
Constructors Constructor Description CharacterReader(Reader input)CharacterReader(Reader input, int sz)CharacterReader(String input) -
Method Summary
Modifier and Type Method Description voidadvance()Moves the current position by one.voidclose()StringconsumeTo(char c)Reads characters up to the specific char.StringconsumeToAny(char... chars)Read characters until the first of any delimiters is found.charcurrent()Get the char at the current position.booleanisEmpty()Tests if all the content has been read.intpos()Gets the current cursor position in the content.StringtoString()
-
Constructor Details
-
Method Details
-
close
public void close() -
pos
public int pos()Gets the current cursor position in the content.- Returns:
- current position
-
isEmpty
public boolean isEmpty()Tests if all the content has been read.- Returns:
- true if nothing left to read.
-
current
public char current()Get the char at the current position.- Returns:
- char
-
advance
public void advance()Moves the current position by one. -
consumeTo
Reads characters up to the specific char.- Parameters:
c- the delimiter- Returns:
- the chars read
-
consumeToAny
Read characters until the first of any delimiters is found.- Parameters:
chars- delimiters to scan for- Returns:
- characters read up to the matched delimiter.
-
toString
-