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

    Fields inherited from class java.io.Reader

    lock
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    peek(char c)
    Peek ahead in the stream to see if the next character matches this one.
    boolean
    peek(char c1, char c2)
    Peek ahead in the stream to see if the next character matches either of these.
    peek(int numChars)
    Peek ahead in the stream to look at this number of characters ahead in the reader.
    peek(int numChars, boolean peekMultipleLines)
    Peek ahead in the stream to look at this number of characters ahead in the reader.
    boolean
    peek(String str)
    Peek ahead in the stream to see if the next characters match this string exactly.
    boolean
    Peek ahead in the stream to see if the next character could be a character part of a keyword or identifier.
    char
    Return the next non-whitespace character
    boolean
    Peek ahead in the stream to see if the next character is numeric.
    boolean
    Peek ahead in the stream to see if the next character is whitespace.
    int
     
    Reads all characters in this stream as long as they can be part of a keyword.
    Reads all characters in this stream as long as they can be part of a numeric constant.
    readUntilExcluding(char delimiter1, char delimiter2)
    Reads all characters in this stream until any of these delimiting characters has been encountered.
    Reads all characters in this stream until any of the delimiting strings is encountered.
    readUntilExcludingWithEscape(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.
    readUntilExcludingWithEscape(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.
    readUntilIncluding(char delimiter)
    Reads all characters in this stream until any of this delimiting character has been encountered.
    readUntilIncluding(String delimiterSequence)
    Reads all characters in this stream until the delimiting sequence is encountered.
    Reads all characters in this stream as long as they are whitespace.
    void
    Swallows the next character.
    void
    swallow(int n)
    Swallows the next n characters.
    void
    swallowUntilExcluding(char delimiter1, char delimiter2)
    Swallows all characters in this stream until any of these delimiting characters has been encountered.
    void
    Swallows all characters in this stream until this delimiting string has been encountered.
    void
    swallowUntilIncludingWithEscape(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.
    void
    swallowUntilIncludingWithEscape(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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • read

      public int read() throws IOException
      Overrides:
      read in class FilterReader
      Throws:
      IOException
    • swallow

      public void swallow() throws IOException
      Swallows the next character.
      Throws:
      IOException
    • swallow

      public void swallow(int n) throws IOException
      Swallows the next n characters.
      Throws:
      IOException
    • peek

      public boolean peek(char c) throws IOException
      Peek ahead in the stream to see if the next character matches this one.
      Parameters:
      c - The character to match.
      Returns:
      true if it does, false if not.
      Throws:
      IOException
    • peek

      public boolean peek(char c1, char c2) throws IOException
      Peek 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:
      true if it does, false if not.
      Throws:
      IOException
    • peekNumeric

      public boolean peekNumeric() throws IOException
      Peek ahead in the stream to see if the next character is numeric.
      Returns:
      true if it is, false if not.
      Throws:
      IOException
    • peekWhitespace

      public boolean peekWhitespace() throws IOException
      Peek ahead in the stream to see if the next character is whitespace.
      Returns:
      true if it is, false if 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:
      true if it is, false if 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:
      true if they do, false if 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 IOException
      Return the next non-whitespace character
      Returns:
      The character
      Throws:
      IOException
    • swallowUntilExcluding

      public void swallowUntilExcluding(char delimiter1, char delimiter2) throws IOException
      Swallows 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 IOException
      Swallows 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 IOException
      Swallows 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