|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jsoup.parser.TokenQueue
public class TokenQueue
A character queue with parsing helpers.
Constructor Summary | |
---|---|
TokenQueue(String data)
Create a new TokenQueue. |
Method Summary | |
---|---|
void |
addFirst(Character c)
Add a character to the start of the queue (will be the next character retrieved). |
void |
addFirst(String seq)
Add a string to the start of the queue. |
String |
chompTo(String seq)
Pulls a string off the queue (like consumeTo), and then pulls off the matched string (but does not return it). |
Character |
consume()
Consume one character off queue. |
void |
consume(String seq)
Consumes the supplied sequence of the queue. |
String |
consumeAttributeKey()
Consume an attribute key off the queue (letter, digit, -, _, :") |
String |
consumeClassName()
Consume a HTML class name off the queue (letter, digit, -, _) |
String |
consumeTo(String seq)
Pulls a string off the queue, up to but exclusive of the match sequence, or to the queue running out. |
String |
consumeToAny(String... seq)
Consumes to the first sequence provided, or to the end of the queue. |
boolean |
consumeWhitespace()
Pulls the next run of whitespace characters of the queue. |
String |
consumeWord()
Retrieves the next run of word type (letter or digit) off the queue. |
boolean |
isEmpty()
Is the queue empty? |
boolean |
matchChomp(String seq)
Tests if the queue matches the sequence (as with match), and if they do, removes the matched string from the queue. |
boolean |
matches(String seq)
Tests if the next characters on the queue match the sequence. |
boolean |
matchesAny(String... seq)
Tests if the next characters match any of the sequences. |
boolean |
matchesWhitespace()
Tests if queue starts with a whitespace character. |
boolean |
matchesWord()
Test if the queue matches a word character (letter or digit). |
Character |
peek()
Retrieves but does not remove the first characater from the queue. |
String |
remainder()
Consume and return whatever is left on the queue. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TokenQueue(String data)
data
- string of data to back queue.Method Detail |
---|
public boolean isEmpty()
public Character peek()
public void addFirst(Character c)
c
- character to addpublic void addFirst(String seq)
seq
- string to add.public boolean matches(String seq)
seq
- String to check queue for.
public boolean matchesAny(String... seq)
seq
-
public boolean matchChomp(String seq)
seq
- String to search for, and if found, remove from queue.
public boolean matchesWhitespace()
public boolean matchesWord()
public Character consume()
public void consume(String seq)
Case insensitive.
seq
- sequence to remove from head of queue.public String consumeTo(String seq)
seq
- String to end on (and not include in return, but leave on queue)
public String consumeToAny(String... seq)
seq
- any number of terminators to consume to
public String chompTo(String seq)
If the queue runs out of characters before finding the seq, will return as much as it can (and queue will go isEmpty() == true).
seq
- String to match up to, and not include in return, and to pull off queue
public boolean consumeWhitespace()
public String consumeWord()
public String consumeClassName()
public String consumeAttributeKey()
public String remainder()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |