- java.lang.Object
-
- io.github.mmm.scanner.AbstractCharStreamScanner
-
- All Implemented Interfaces:
CharStreamScanner
- Direct Known Subclasses:
CharReaderScanner,CharSequenceScanner
public abstract class AbstractCharStreamScanner extends Object implements CharStreamScanner
Abstract implementation ofCharStreamScanner.
ATTENTION:
This implementation and its sub-classes are NOT thread-safe and have no intention to be thread-safe.
-
-
Constructor Summary
Constructors Constructor Description AbstractCharStreamScanner(char[] buffer)The constructor.AbstractCharStreamScanner(int capacity)The constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected StringBuilderappend(StringBuilder builder, int start, int end)protected StringBuilderbuilder(StringBuilder builder)StringconsumeDecimal()Consumes the characters of a decimal number (double or float).protected Stringeot(StringBuilder builder, boolean acceptEot)booleanexpect(char expected)This method checks that thecurrent characteris equal to the givenexpectedcharacter.booleanexpect(String expected, boolean ignoreCase)This method skips allnext charactersas long as they equal to the according character of theexpectedstring.protected abstract booleanexpectRestWithLookahead(char[] stopChars, boolean ignoreCase, Runnable appender, boolean skip)protected booleanfill()Fills the internalbufferwith further data (if available from underlying source such as a stream/reader).charforceNext()LikeCharStreamScanner.next()this method reads the current character and increments the index.charforcePeek()This method reads the current character without incrementing the index.protected StringgetAppended(StringBuilder builder, int start, int end)booleanhasNext()This method determines if there is at least one more character available.protected booleanisEob()booleanisEos()booleanisEot()charnext()This method reads the current character and increments the index stepping to the next character.charpeek()This method reads the current character without incrementing the index.Stringread(int count)This method reads the number ofnext charactersgiven bycountand returns them as string.intreadDigit(int radix)This method reads thenext characterif it is a digit within the givenradix.CharacterreadJavaCharLiteral(boolean tolerant)Reads and parses a JavaCharacterliteral value according to JLS 3.10.6.StringreadJavaStringLiteral(boolean tolerant)Reads and parses a JavaStringliteral value according to JLS 3.10.6.StringreadLine(boolean trim)longreadLong(int maxDigits)This method reads the long starting at the current position by reading as many Latin digits as available but at maximum the givenmaxDigitsand returns itsparsedvalue.StringreadUntil(char stop, boolean acceptEot)This method reads allnext charactersuntil the givenstopcharacter or the end is reached.StringreadUntil(char stop, boolean acceptEot, char escape)This method reads allnext charactersuntil the given (un-escaped)stopcharacter or the end is reached.StringreadUntil(char stop, boolean acceptEot, CharScannerSyntax syntax)This method reads allnext charactersuntil the givenstopcharacter or the end of the string to parse is reached.StringreadUntil(CharFilter filter, boolean acceptEot)This method reads allnext charactersuntil the first characteracceptedby the givenfilteror the end is reached.StringreadUntil(CharFilter filter, boolean acceptEot, CharScannerSyntax syntax)This method reads allnext charactersuntil the givenCharFilteracceptsthe current character as stop character or the end of text (EOT) is reached.StringreadUntil(CharFilter stopFilter, boolean acceptEot, String stop, boolean ignoreCase, boolean trim)This method reads allnext charactersuntil the first characteracceptedby the givenfilter, the givenstopStringor the end is reached.StringreadWhile(CharFilter filter, int max)voidrequire(char expected)This method verifies that thecurrent characteris equal to the givenexpectedcharacter.voidrequire(String expected, boolean ignoreCase)This method verifies that theexpectedstring gets consumed from this scanner with respect toignoreCase.protected voidreset()Resets the internal state.intskip(int count)This method skips the number ofnext charactersgiven bycount.booleanskipOver(String substring, boolean ignoreCase, CharFilter stopFilter)This method consumes allnext charactersuntil the givensubstringhas been detected, a character wasacceptedby the givenCharFilterorEOTwas reached.
After the call of this method this scanner will point to the next character after the first occurrence ofsubstring, to the stop character or toEOT.booleanskipUntil(char stop)This method skips allnext charactersuntil the givenstopcharacter or the end is reached.booleanskipUntil(char stop, char escape)This method reads allnext charactersuntil the givenstopcharacter or the end of the string to parse is reached.intskipWhile(char c)This method reads allnext charactersthat are identical to the character given byc.intskipWhile(CharFilter filter, int max)StringtoString()protected voidverifyLookahead(String substring)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.github.mmm.scanner.CharStreamScanner
expect, expectStrict, expectStrict, readDigit, readDouble, readFloat, readJavaCharLiteral, readJavaStringLiteral, readLine, readUntil, readUntil, readWhile, skipOver, skipOver, skipWhile, skipWhileAndPeek, skipWhileAndPeek
-
-
-
-
Field Detail
-
buffer
protected char[] buffer
The internal buffer with character data.
-
offset
protected int offset
The start position in thebufferfrom where reading operations consumer data from.
-
limit
protected int limit
-
-
Constructor Detail
-
AbstractCharStreamScanner
public AbstractCharStreamScanner(int capacity)
The constructor.- Parameters:
capacity- the capacity of the internal buffer inchars.
-
AbstractCharStreamScanner
public AbstractCharStreamScanner(char[] buffer)
The constructor.- Parameters:
buffer- the internalchar[]buffer.
-
-
Method Detail
-
reset
protected void reset()
Resets the internal state.
-
builder
protected StringBuilder builder(StringBuilder builder)
- Parameters:
builder- a localStringBuildervariable to be allocated lazily.- Returns:
- the given
StringBuilderif notnullor otherwise a reusedStringBuilderinstance that has been reset.
-
append
protected StringBuilder append(StringBuilder builder, int start, int end)
- Parameters:
builder- a localStringBuildervariable to be allocated lazily.start- the start index in the underlying buffer to append.end- the limit index in the underlying buffer pointing to the next position after the last character to append.- Returns:
- the given
StringBuilderif notnullor otherwise a reusedStringBuilderinstance that has been reset.
-
getAppended
protected String getAppended(StringBuilder builder, int start, int end)
- Parameters:
builder- the localStringBuilderinstance where data may already have been appended to. May benull.start- the start index in the underlying buffer to append.end- the limit index in the underlying buffer pointing to the next position after the last character to append.- Returns:
- the
Stringwith the underlying buffer data fromstarttoend-1potentially appended to the givenStringBuilderif notnull.
-
hasNext
public boolean hasNext()
Description copied from interface:CharStreamScannerThis method determines if there is at least one more character available.- Specified by:
hasNextin interfaceCharStreamScanner- Returns:
trueif there is at least one character available,falseif the end of text (EOT) has been reached.
-
isEos
public boolean isEos()
- Specified by:
isEosin interfaceCharStreamScanner- Returns:
trueif the end of stream (EOS) has been reached,falseotherwise. Iftrue(EOS) the internal buffer contains the entire rest of the data to scan in memory. If then also all data is consumed from the buffer,EOThas been reached. For instances of that are not backed by an underlying stream of data (likeCharSequenceScanner) this method will always returntrue.
-
isEob
protected boolean isEob()
-
isEot
public boolean isEot()
- Specified by:
isEotin interfaceCharStreamScanner- Returns:
trueif end of text (EOT) is known to have been reached,falseotherwise. The returned result will be almost the same as!but this method will not modify the state of this scanner (read additional data, modify buffers, etc.). However, if the underlying stream is already consumed without returningCharStreamScanner.hasNext()-1to signalEOSthis method may returnfalseeven though the next call ofCharStreamScanner.hasNext()may also returnfalse.
-
fill
protected boolean fill()
Fills the internalbufferwith further data (if available from underlying source such as a stream/reader). If theend of the streamhas not been reached, all buffers should be filled now.- Returns:
trueif data was filled,falseifEOS.
-
next
public char next()
Description copied from interface:CharStreamScannerThis method reads the current character and increments the index stepping to the next character. You need tocheckif a character is available before calling this method.- Specified by:
nextin interfaceCharStreamScanner- Returns:
- the current character.
-
forceNext
public char forceNext()
Description copied from interface:CharStreamScannerLikeCharStreamScanner.next()this method reads the current character and increments the index. If there is no characteravailablethis method will do nothing but return'\0'(the NULL character and NOT'0').- Specified by:
forceNextin interfaceCharStreamScanner- Returns:
- the current character or
0if none isavailable.
-
peek
public char peek()
Description copied from interface:CharStreamScannerThis method reads the current character without incrementing the index. You need tocheckif a character is available before calling this method.- Specified by:
peekin interfaceCharStreamScanner- Returns:
- the current character.
-
forcePeek
public char forcePeek()
Description copied from interface:CharStreamScannerThis method reads the current character without incrementing the index. If there is no characteravailablethis method will return0(the NULL character and NOT'0').- Specified by:
forcePeekin interfaceCharStreamScanner- Returns:
- the current character or
0if none isavailable.
-
eot
protected String eot(StringBuilder builder, boolean acceptEot)
- Parameters:
builder- the optionalStringBuilderwhere data may have already been appended.acceptEot-trueto acceptEOT,falseotherwise.- Returns:
nullifacceptEotisfalse, otherwise theStringfrom the givenStringBuilderor the emptyStringin case theStringBuilderwasnull.
-
readUntil
public String readUntil(char stop, boolean acceptEot)
Description copied from interface:CharStreamScannerThis method reads allnext charactersuntil the givenstopcharacter or the end is reached.
After the call of this method, the current index will point to the next character after the (first)stopcharacter or to the end if NO such character exists.- Specified by:
readUntilin interfaceCharStreamScanner- Parameters:
stop- is the character to read until.acceptEot- iftrueEOTwill be treated asstop, too.- Returns:
- the string with all read characters excluding the
stopcharacter ornullif there was nostopcharacter andacceptEotisfalse.
-
readUntil
public String readUntil(char stop, boolean acceptEot, CharScannerSyntax syntax)
Description copied from interface:CharStreamScannerThis method reads allnext charactersuntil the givenstopcharacter or the end of the string to parse is reached. In advance toCharStreamScanner.readUntil(char, boolean), this method will scan the input using the givensyntaxwhich e.g. allows toescapethe stop character.
After the call of this method, the current index will point to the next character after the (first)stopcharacter or to the end of the string if NO such character exists.- Specified by:
readUntilin interfaceCharStreamScanner- Parameters:
stop- is the character to read until.acceptEot- iftrueEOTwill be treated asstop, too.syntax- contains the characters specific for the syntax to read.- Returns:
- the string with all read characters excluding the
stopcharacter ornullif there was nostopcharacter. - See Also:
CharStreamScanner.readUntil(CharFilter, boolean, CharScannerSyntax)
-
readUntil
public String readUntil(CharFilter filter, boolean acceptEot, CharScannerSyntax syntax)
Description copied from interface:CharStreamScannerThis method reads allnext charactersuntil the givenCharFilteracceptsthe current character as stop character or the end of text (EOT) is reached. In advance toCharStreamScanner.readUntil(char, boolean), this method will scan the input using the givensyntaxwhich e.g. allows toescapethe stop character.
After the call of this method, the current index will point to the next character after the (first)stopcharacter or to the end of the string if NO such character exists.- Specified by:
readUntilin interfaceCharStreamScanner- Parameters:
filter- is used todecidewhere to stop.acceptEot- iftrueEOTwill be treated asstop, too.syntax- contains the characters specific for the syntax to read.- Returns:
- the string with all read characters excluding the
stopcharacter ornullif there was nostopcharacter. - See Also:
CharStreamScanner.readUntil(char, boolean, CharScannerSyntax)
-
readUntil
public String readUntil(char stop, boolean acceptEot, char escape)
Description copied from interface:CharStreamScannerThis method reads allnext charactersuntil the given (un-escaped)stopcharacter or the end is reached.
In advance toCharStreamScanner.readUntil(char, boolean), this method allows that thestopcharacter may be used in the input-string by adding the givenescapecharacter. After the call of this method, the current index will point to the next character after the (first)stopcharacter or to the end if NO such character exists.
This method is especially useful when quoted strings should be parsed. E.g.:CharStreamScannerscanner = getScanner(); doSomething(); char c = scanner.CharStreamScanner.forceNext(); if ((c == '"') || (c == '\'')) { char escape = c; // may also be something like '\' String quote = scanner.readUntil(c, false, escape) } else { doOtherThings(); }- Specified by:
readUntilin interfaceCharStreamScanner- Parameters:
stop- is the character to read until.acceptEot- iftrueEOTwill be treated asstop, too.escape- is the character used to escape thestopcharacter. To add an occurrence of theescapecharacter it has to be duplicated (occur twice). Theescapecharacter may also be equal to thestopcharacter. If other regular characters are escaped theescapecharacter is simply ignored.- Returns:
- the string with all read characters excluding the
stopcharacter ornullif there was nostopcharacter andacceptEotisfalse.
-
readUntil
public String readUntil(CharFilter filter, boolean acceptEot)
Description copied from interface:CharStreamScannerThis method reads allnext charactersuntil the first characteracceptedby the givenfilteror the end is reached.
After the call of this method, the current index will point to the firstacceptedstop character or to the end if NO such character exists.- Specified by:
readUntilin interfaceCharStreamScanner- Parameters:
filter- is used todecidewhere to stop.acceptEot- iftrueifEOTshould be treated like thestopcharacter and the rest of the text will be returned,falseotherwise (to returnnullifEOTwas reached and the scanner has been consumed).- Returns:
- the string with all read characters not
acceptedby the givenCharFilterornullif there was noacceptedcharacter andacceptEotisfalse.
-
readUntil
public String readUntil(CharFilter stopFilter, boolean acceptEot, String stop, boolean ignoreCase, boolean trim)
Description copied from interface:CharStreamScannerThis method reads allnext charactersuntil the first characteracceptedby the givenfilter, the givenstopStringor the end is reached.
After the call of this method, the current index will point to the firstacceptedstop character, or to the first character of the givenstopStringor to the end if NO such character exists.- Specified by:
readUntilin interfaceCharStreamScanner- Parameters:
stopFilter- is used todecidewhere to stop.acceptEot- iftrueifEOTshould be treated like thestopcharacter and the rest of the text will be returned,falseotherwise (to returnnullifEOTwas reached and the scanner has been consumed).stop- theStringwhere to stop consuming data. Should be at least two characters long (otherwise accept byCharFilterinstead).ignoreCase- - iftruethe case of the characters is ignored when compared with characters fromstopString.trim- -trueif the result should betrimmed,falseotherwise.- Returns:
- the string with all read characters not
acceptedby the givenCharFilteror until the givenstopStringwas detected. IfEOTwas reached without a stop signal the entire rest of the data is returned ornullifacceptEotisfalse. Thre result will betrimmediftrimistrue.
-
verifyLookahead
protected void verifyLookahead(String substring)
- Parameters:
substring- the substring to match without consuming what requires a lookahead.
-
expectRestWithLookahead
protected abstract boolean expectRestWithLookahead(char[] stopChars, boolean ignoreCase, Runnable appender, boolean skip)- Parameters:
stopChars- the stopStringaschar[]. IfignoreCaseistruein lower case.ignoreCase- -trueto (also) compare chars inlower case,falseotherwise.appender- an optional lambda torunbefore shifting buffers to append data.skip- -trueto update buffers and offset such that on success this scanner points after the expected stopString,falseotherwise (to not consume any character in any case).- Returns:
trueif the stopString(stopChars) was found and consumed,falseotherwise (and no data consumed).- See Also:
CharStreamScanner.readUntil(CharFilter, boolean, String, boolean),skipOver(String, boolean, CharFilter)
-
require
public void require(char expected)
Description copied from interface:CharStreamScannerThis method verifies that thecurrent characteris equal to the givenexpectedcharacter.
If the current character was as expected, the parser points to the next character. Otherwise an exception is thrown indicating the problem.- Specified by:
requirein interfaceCharStreamScanner- Parameters:
expected- is the expected character.
-
require
public void require(String expected, boolean ignoreCase)
Description copied from interface:CharStreamScannerThis method verifies that theexpectedstring gets consumed from this scanner with respect toignoreCase. Otherwise an exception is thrown indicating the problem.
This method behaves functionally equivalent to the following code:if (!scanner.
expectStrict(expected, ignoreCase)) { throw newIllegalStateException(...); }- Specified by:
requirein interfaceCharStreamScanner- Parameters:
expected- is the expected string.ignoreCase- - iftruethe case of the characters is ignored during comparison.
-
expect
public boolean expect(char expected)
Description copied from interface:CharStreamScannerThis method checks that thecurrent characteris equal to the givenexpectedcharacter.
If the current character was as expected, the parser points to the next character. Otherwise its position will remain unchanged.- Specified by:
expectin interfaceCharStreamScanner- Parameters:
expected- is the expected character.- Returns:
trueif the current character is the same asexpected,falseotherwise.
-
expect
public boolean expect(String expected, boolean ignoreCase)
Description copied from interface:CharStreamScannerThis method skips allnext charactersas long as they equal to the according character of theexpectedstring.
If a character differs this method stops and the parser points to the first character that differs fromexpected. Except for the latter circumstance, this method behaves like the following code:
ATTENTION:read(expected.length).equals[IgnoreCase](expected)
Be aware that if already the first character differs, this method will NOT change the state of the scanner. So take care NOT to produce infinity loops.- Specified by:
expectin interfaceCharStreamScanner- Parameters:
expected- is the expected string.ignoreCase- - iftruethe case of the characters is ignored when compared.- Returns:
trueif theexpectedstring was successfully consumed from this scanner,falseotherwise.
-
readLine
public String readLine(boolean trim)
- Specified by:
readLinein interfaceCharStreamScanner- Parameters:
trim- -trueif the result should betrimmed,falseotherwise.- Returns:
- a
Stringwith the data until the end of the current line (trimmediftrimistrue) orEOT. Will benullif the EOT has already been reached andCharStreamScanner.hasNext()returnsfalse.
-
readJavaStringLiteral
public String readJavaStringLiteral(boolean tolerant)
Description copied from interface:CharStreamScannerReads and parses a JavaStringliteral value according to JLS 3.10.6.
As a complex example for the input "Hi \"\176\477\579•∑\"\n" this scanner would return theStringoutputHi "~'7/9•∑"followed by a newline character.- Specified by:
readJavaStringLiteralin interfaceCharStreamScanner- Parameters:
tolerant- -trueif invalid escape sequences should be tolerated (as '?'),falseto throw an exception in such case.- Returns:
- the parsed Java
Stringliteral value ornullif not pointing to aStringliteral.
-
readJavaCharLiteral
public Character readJavaCharLiteral(boolean tolerant)
Description copied from interface:CharStreamScannerReads and parses a JavaCharacterliteral value according to JLS 3.10.6.
Examples are given in the following table:literal result comment 'a'a regular char '\''' escaped char '\176'~ escaped octal representation '•'• escaped unicode representation - Specified by:
readJavaCharLiteralin interfaceCharStreamScanner- Parameters:
tolerant- -trueif an invalid char literal should be tolerated (as '?'),falseto throw an exception in such case.- Returns:
- the parsed Java
Stringliteral value ornullif not pointing to aStringliteral.
-
read
public String read(int count)
Description copied from interface:CharStreamScannerThis method reads the number ofnext charactersgiven bycountand returns them as string. If there are less charactersavailablethe returned string will be shorter thancountand only contain the available characters.- Specified by:
readin interfaceCharStreamScanner- Parameters:
count- is the number of characters to read. You may useInteger.MAX_VALUEto read until the end of data if the data-size is suitable.- Returns:
- a string with the given number of characters or all available characters if less than
count. Will be the empty string if no character isavailableat all.
-
readDigit
public int readDigit(int radix)
Description copied from interface:CharStreamScannerThis method reads thenext characterif it is a digit within the givenradix. Else the state remains unchanged.- Specified by:
readDigitin interfaceCharStreamScanner- Parameters:
radix- the radix that defines the range of the digits. SeeInteger.parseInt(String, int). E.g.10to read any Latin digit (seeCharStreamScanner.readDigit()),8to read octal digit,16to read hex decimal digits.- Returns:
- the numeric value of the next digit within the given
radixor-1if thecurrent characteris no such digit.
-
consumeDecimal
public String consumeDecimal()
Description copied from interface:CharStreamScannerConsumes the characters of a decimal number (double or float).- Specified by:
consumeDecimalin interfaceCharStreamScanner- Returns:
- the decimal number as
String.
-
readLong
public long readLong(int maxDigits) throws NumberFormatExceptionDescription copied from interface:CharStreamScannerThis method reads the long starting at the current position by reading as many Latin digits as available but at maximum the givenmaxDigitsand returns itsparsedvalue.
ATTENTION:
This method does NOT treat signs (+or-) to do so, scan them yourself before and negate the result as needed.- Specified by:
readLongin interfaceCharStreamScanner- Parameters:
maxDigits- is the maximum number of digits that will be read. The value has to be positive (greater than zero). Use19or higher to be able to read any long number.- Returns:
- the parsed number.
- Throws:
NumberFormatException- if the current current position does NOT point to a number.
-
skip
public int skip(int count)
Description copied from interface:CharStreamScannerThis method skips the number ofnext charactersgiven bycount.- Specified by:
skipin interfaceCharStreamScanner- Parameters:
count- is the number of characters to skip. You may useInteger.MAX_VALUEto read until the end of data if the data-size is suitable.- Returns:
- a to total number of characters that have been skipped. Typically equal to
count. Will be less in case theend of the streamwas reached.
-
skipUntil
public boolean skipUntil(char stop)
Description copied from interface:CharStreamScannerThis method skips allnext charactersuntil the givenstopcharacter or the end is reached. If thestopcharacter was reached, this scanner will point to the next character afterstopwhen this method returns.- Specified by:
skipUntilin interfaceCharStreamScanner- Parameters:
stop- is the character to read until.- Returns:
trueif the first occurrence of the givenstopcharacter has been passed,falseif there is no such character.
-
skipUntil
public boolean skipUntil(char stop, char escape)Description copied from interface:CharStreamScannerThis method reads allnext charactersuntil the givenstopcharacter or the end of the string to parse is reached. In advance toCharStreamScanner.skipUntil(char), this method will read over thestopcharacter if it is escaped with the givenescapecharacter.- Specified by:
skipUntilin interfaceCharStreamScanner- Parameters:
stop- is the character to read until.escape- is the character used to escape the stop character (e.g. '\').- Returns:
trueif the first occurrence of the givenstopcharacter has been passed,falseif there is no such character.
-
skipWhile
public int skipWhile(char c)
Description copied from interface:CharStreamScannerThis method reads allnext charactersthat are identical to the character given byc.
E.g. usereadWhile(' ')to skip all blanks from the current index. After the call of this method, the current index will point to the next character that is different to the given charactercor to the end if NO such character exists.- Specified by:
skipWhilein interfaceCharStreamScanner- Parameters:
c- is the character to read over.- Returns:
- the number of characters that have been skipped.
-
skipWhile
public int skipWhile(CharFilter filter, int max)
Description copied from interface:CharStreamScannerThis method reads allnext charactersthat areacceptedby the givenfilter.
After the call of this method, the current index will point to the next character that was NOTacceptedby the givenfilter. If the nextmaxcharacters or the characters left until theendof this scanner areaccepted, only that amount of characters are skipped.- Specified by:
skipWhilein interfaceCharStreamScanner- Parameters:
filter- is used todecidewhich characters should be accepted.max- is the maximum number of characters that may be skipped.- Returns:
- the number of skipped characters.
- See Also:
CharStreamScanner.skipWhile(char)
-
skipOver
public boolean skipOver(String substring, boolean ignoreCase, CharFilter stopFilter)
Description copied from interface:CharStreamScannerThis method consumes allnext charactersuntil the givensubstringhas been detected, a character wasacceptedby the givenCharFilterorEOTwas reached.
After the call of this method this scanner will point to the next character after the first occurrence ofsubstring, to the stop character or toEOT.- Specified by:
skipOverin interfaceCharStreamScanner- Parameters:
substring- is the substring to search and skip over starting at the current index.ignoreCase- - iftruethe case of the characters is ignored when compared with characters fromsubstring.stopFilter- is the filter used todetectstop characters. If such character was detected, the skip is stopped and the parser points to the character after the stop character. Thesubstringshould NOT contain astop character.- Returns:
trueif the givensubstringoccurred and has been passed andfalseif a stop character has been detected or the end of the string has been reached without any occurrence of the givensubstringor stop character.
-
readWhile
public String readWhile(CharFilter filter, int max)
Description copied from interface:CharStreamScannerThis method reads allnext charactersthat areacceptedby the givenfilter.
After the call of this method, the current index will point to the next character that was NOTacceptedby the givenfilter. If the nextmaxcharacters or the characters left until theendof this scanner areaccepted, only that amount of characters are skipped.- Specified by:
readWhilein interfaceCharStreamScanner- Parameters:
filter- is used todecidewhich characters should be accepted.max- is the maximum number of characters that should be read.- Returns:
- a string with all characters
acceptedby the givenfilterlimited to the length ofmaxand theendof this scanner. Will be the empty string if no character was accepted. - See Also:
CharStreamScanner.skipWhile(char)
-
-