Class PeekingReader
- java.lang.Object
-
- java.io.Reader
-
- java.io.FilterReader
-
- migratedb.v1.core.internal.parser.PeekingReader
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
public class PeekingReader extends FilterReader
-
-
Field Summary
-
Fields inherited from class java.io.FilterReader
in
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanpeek(char c)Peek ahead in the stream to see if the next character matches this one.booleanpeek(char c1, char c2)Peek ahead in the stream to see if the next character matches either of these.Stringpeek(int numChars)Peek ahead in the stream to look at this number of characters ahead in the reader.Stringpeek(int numChars, boolean peekMultipleLines)Peek ahead in the stream to look at this number of characters ahead in the reader.booleanpeek(String str)Peek ahead in the stream to see if the next characters match this string exactly.booleanpeekKeywordPart(ParserContext context)Peek ahead in the stream to see if the next character could be a character part of a keyword or identifier.charpeekNextNonWhitespace()Return the next non-whitespace characterbooleanpeekNumeric()Peek ahead in the stream to see if the next character is numeric.booleanpeekWhitespace()Peek ahead in the stream to see if the next character is whitespace.intread()StringreadKeywordPart(Delimiter delimiter, ParserContext context)Reads all characters in this stream as long as they can be part of a keyword.StringreadNumeric()Reads all characters in this stream as long as they can be part of a numeric constant.StringreadUntilExcluding(char delimiter1, char delimiter2)Reads all characters in this stream until any of these delimiting characters has been encountered.StringreadUntilExcluding(String... strings)Reads all characters in this stream until any of the delimiting strings is encountered.StringreadUntilExcludingWithEscape(char delimiter, boolean selfEscape)Reads all characters in this stream until this delimiting character has been encountered, taking into account this escape character for the delimiting character.StringreadUntilExcludingWithEscape(char delimiter, boolean selfEscape, char escape)Reads all characters in this stream until this delimiting character has been encountered, taking into account this escape character for the delimiting character.StringreadUntilIncluding(char delimiter)Reads all characters in this stream until any of this delimiting character has been encountered.StringreadUntilIncluding(String delimiterSequence)Reads all characters in this stream until the delimiting sequence is encountered.StringreadWhitespace()Reads all characters in this stream as long as they are whitespace.voidswallow()Swallows the next character.voidswallow(int n)Swallows the next n characters.voidswallowUntilExcluding(char delimiter1, char delimiter2)Swallows all characters in this stream until any of these delimiting characters has been encountered.voidswallowUntilExcluding(String str)Swallows all characters in this stream until this delimiting string has been encountered.voidswallowUntilIncludingWithEscape(char delimiter, boolean selfEscape)Swallows all characters in this stream until this delimiting character has been encountered, taking into account this escape character for the delimiting character.voidswallowUntilIncludingWithEscape(char delimiter, boolean selfEscape, char escape)Swallows all characters in this stream until this delimiting character has been encountered, taking into account this escape character for the delimiting character.-
Methods inherited from class java.io.FilterReader
close, mark, markSupported, read, ready, reset, skip
-
Methods inherited from class java.io.Reader
nullReader, read, read, transferTo
-
-
-
-
Method Detail
-
read
public int read() throws IOException- Overrides:
readin classFilterReader- Throws:
IOException
-
swallow
public void swallow() throws IOExceptionSwallows the next character.- Throws:
IOException
-
swallow
public void swallow(int n) throws IOExceptionSwallows the next n characters.- Throws:
IOException
-
peek
public boolean peek(char c) throws IOExceptionPeek ahead in the stream to see if the next character matches this one.- Parameters:
c- The character to match.- Returns:
trueif it does,falseif not.- Throws:
IOException
-
peek
public boolean peek(char c1, char c2) throws IOExceptionPeek ahead in the stream to see if the next character matches either of these.- Parameters:
c1- The first character to match.c2- The second character to match.- Returns:
trueif it does,falseif not.- Throws:
IOException
-
peekNumeric
public boolean peekNumeric() throws IOExceptionPeek ahead in the stream to see if the next character is numeric.- Returns:
trueif it is,falseif not.- Throws:
IOException
-
peekWhitespace
public boolean peekWhitespace() throws IOExceptionPeek ahead in the stream to see if the next character is whitespace.- Returns:
trueif it is,falseif not.- Throws:
IOException
-
peekKeywordPart
public boolean peekKeywordPart(ParserContext context) throws IOException
Peek ahead in the stream to see if the next character could be a character part of a keyword or identifier.- Returns:
trueif it is,falseif not.- Throws:
IOException
-
peek
public boolean peek(String str) throws IOException
Peek ahead in the stream to see if the next characters match this string exactly.- Parameters:
str- The string to match.- Returns:
trueif they do,falseif not.- Throws:
IOException
-
peek
public String peek(int numChars) throws IOException
Peek ahead in the stream to look at this number of characters ahead in the reader.- Parameters:
numChars- The number of characters.- Returns:
- The characters.
- Throws:
IOException
-
peek
public String peek(int numChars, boolean peekMultipleLines) throws IOException
Peek ahead in the stream to look at this number of characters ahead in the reader.- Parameters:
numChars- The number of characters.peekMultipleLines- Whether the peek should go across lines or not- Returns:
- The characters.
- Throws:
IOException
-
peekNextNonWhitespace
public char peekNextNonWhitespace() throws IOExceptionReturn the next non-whitespace character- Returns:
- The character
- Throws:
IOException
-
swallowUntilExcluding
public void swallowUntilExcluding(char delimiter1, char delimiter2) throws IOExceptionSwallows all characters in this stream until any of these delimiting characters has been encountered.- Parameters:
delimiter1- The first delimiting character.delimiter2- The second delimiting character.- Throws:
IOException
-
readUntilExcluding
public String readUntilExcluding(char delimiter1, char delimiter2) throws IOException
Reads all characters in this stream until any of these delimiting characters has been encountered.- Parameters:
delimiter1- The first delimiting character.delimiter2- The second delimiting character.- Returns:
- The string read, without the delimiting characters.
- Throws:
IOException
-
swallowUntilIncludingWithEscape
public void swallowUntilIncludingWithEscape(char delimiter, boolean selfEscape) throws IOExceptionSwallows all characters in this stream until this delimiting character has been encountered, taking into account this escape character for the delimiting character.- Parameters:
delimiter- The delimiting character.selfEscape- Whether the delimiter can escape itself by being present twice.- Throws:
IOException
-
swallowUntilIncludingWithEscape
public void swallowUntilIncludingWithEscape(char delimiter, boolean selfEscape, char escape) throws IOExceptionSwallows all characters in this stream until this delimiting character has been encountered, taking into account this escape character for the delimiting character.- Parameters:
delimiter- The delimiting character.selfEscape- Whether the delimiter can escape itself by being present twice.escape- A separate escape character.- Throws:
IOException
-
readUntilExcludingWithEscape
public String readUntilExcludingWithEscape(char delimiter, boolean selfEscape) throws IOException
Reads all characters in this stream until this delimiting character has been encountered, taking into account this escape character for the delimiting character.- Parameters:
delimiter- The delimiting character.selfEscape- Whether the delimiter can escape itself by being present twice.- Returns:
- The string read, without the delimiting character.
- Throws:
IOException
-
readUntilExcludingWithEscape
public String readUntilExcludingWithEscape(char delimiter, boolean selfEscape, char escape) throws IOException
Reads all characters in this stream until this delimiting character has been encountered, taking into account this escape character for the delimiting character.- Parameters:
delimiter- The delimiting character.selfEscape- Whether the delimiter can escape itself by being present twice.escape- A separate escape character.- Returns:
- The string read, without the delimiting character.
- Throws:
IOException
-
swallowUntilExcluding
public void swallowUntilExcluding(String str) throws IOException
Swallows all characters in this stream until this delimiting string has been encountered.- Parameters:
str- The delimiting string.- Throws:
IOException
-
readUntilExcluding
public String readUntilExcluding(String... strings) throws IOException
Reads all characters in this stream until any of the delimiting strings is encountered.- Parameters:
strings- The delimiting strings.- Returns:
- The string read, without the delimiting string.
- Throws:
IOException
-
readUntilIncluding
public String readUntilIncluding(char delimiter) throws IOException
Reads all characters in this stream until any of this delimiting character has been encountered.- Parameters:
delimiter- The delimiting character.- Returns:
- The string read, including the delimiting characters.
- Throws:
IOException
-
readUntilIncluding
public String readUntilIncluding(String delimiterSequence) throws IOException
Reads all characters in this stream until the delimiting sequence is encountered.- Parameters:
delimiterSequence- The delimiting sequence.- Returns:
- The string read, including the delimiting characters.
- Throws:
IOException
-
readKeywordPart
public String readKeywordPart(Delimiter delimiter, ParserContext context) throws IOException
Reads all characters in this stream as long as they can be part of a keyword.- Parameters:
delimiter- The current delimiter.- Returns:
- The string read.
- Throws:
IOException
-
readNumeric
public String readNumeric() throws IOException
Reads all characters in this stream as long as they can be part of a numeric constant.- Returns:
- The string read.
- Throws:
IOException
-
readWhitespace
public String readWhitespace() throws IOException
Reads all characters in this stream as long as they are whitespace.- Returns:
- The string read.
- Throws:
IOException
-
-