EX - The exception type that the delegate ProducerWhichThrows may throwpublic class StringStream<EX extends Throwable> extends Object
ProducerWhichThrows<String>.
A "null" product is interpreted as the "end-of-input" condition.
| Modifier and Type | Class and Description |
|---|---|
static class |
StringStream.UnexpectedElementException
Indication that a string is not as expected.
|
| Constructor and Description |
|---|
StringStream(ProducerWhichThrows<? extends String,? extends EX> producer) |
StringStream(ProducerWhichThrows<? extends String,? extends EX> producer,
String unexpectedElementExceptionMessagePrefix) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
atEnd() |
String |
group(int group) |
String |
peek() |
boolean |
peek(Pattern pattern) |
boolean |
peek(String expected) |
boolean |
peekRead(Pattern pattern)
Consumes the next string iff it matches the given pattern.
|
int |
peekRead(String... expected)
Consumes the next string iff it equals one of the expected strings.
|
boolean |
peekRead(String expected)
Consumes the next string iff it equals the expected string.
|
String |
read()
Verifies that the next string is not
null, and consumes it. |
void |
read(Pattern pattern)
Verifies that the next string matches the given pattern.
|
void |
read(String expected)
Verifies that the next string equals the given expected string, and consumes it.
|
String[] |
readRest()
Consumes and returns all remaining elements.
|
public StringStream(ProducerWhichThrows<? extends String,? extends EX> producer)
StringStreampublic StringStream(ProducerWhichThrows<? extends String,? extends EX> producer, @Nullable String unexpectedElementExceptionMessagePrefix)
StringStreampublic String peek() throws EX extends Throwable, StringStream.UnexpectedElementException
StringStream.UnexpectedElementException - The next string was nullEX extends Throwablepublic boolean peekRead(@Nullable
String expected)
throws EX extends Throwable
public boolean peekRead(@Nullable
Pattern pattern)
throws EX extends Throwable
EX extends Throwablegroup(int)public int peekRead(String... expected) throws EX extends Throwable
public String read() throws StringStream.UnexpectedElementException, EX extends Throwable
null, and consumes it.StringStream.UnexpectedElementException - The next string is nullEX extends Throwablepublic void read(String expected) throws StringStream.UnexpectedElementException, EX extends Throwable
StringStream.UnexpectedElementException - The next string does equal the expected stringEX extends Throwablepublic void read(Pattern pattern) throws EX extends Throwable, StringStream.UnexpectedElementException
StringStream.UnexpectedElementException - The next string does match the patternEX extends Throwablepublic String[] readRest() throws EX extends Throwable
@Nullable public String group(int group)
read(Pattern), peek(Pattern) or peekRead(Pattern) operation, or
null if the group failed to match part of the inputMatcher.group(int)Copyright © 2018 Arno Unkrig. All rights reserved.