Class FooterSkipBufferedReader

java.lang.Object
java.io.Reader
java.io.BufferedReader
io.deephaven.importers.util.FooterSkipBufferedReader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable

public class FooterSkipBufferedReader extends BufferedReader
A BufferedReader that skips a specified number of lines at the end of the stream.
  • Field Summary

    Fields inherited from class java.io.Reader

    lock
  • Constructor Summary

    Constructors
    Constructor
    Description
    FooterSkipBufferedReader(@NotNull Reader in, int skipFooterLines)
    Creates a buffered reader using FooterSkipBufferedReader(Reader, int, int) that will skip a specified number of rows at the end, using the default buffer size of DEFAULT_BUFFER_SIZE.
    FooterSkipBufferedReader(@NotNull Reader in, int skipFooterLines, int bufferSize)
    Creates a buffered reader that will skip a specified number of rows at the end, using the specified buffer size.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    Returns the default buffer size, in characters, that will be used if no size is specified when the reader is created
    Unsupported by the FooterSkipBufferedReader
    void
    mark(int readAheadLimit)
    Unsupported by the FooterSkipBufferedReader
    boolean
    Tells whether this stream supports the mark() operation, which it does not.
    int
    Reads a single character up to the lines to be skipped as specified in the constructor.
    int
    read(char @NotNull [] cbuf, int off, int len)
     
    Reads a line of text.
    void
    Unsupported by the FooterSkipBufferedReader
    long
    skip(long n)
    Unsupported by the FooterSkipBufferedReader

    Methods inherited from class java.io.BufferedReader

    close, ready

    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
  • Constructor Details

    • FooterSkipBufferedReader

      public FooterSkipBufferedReader(@NotNull @NotNull Reader in, int skipFooterLines)
      Creates a buffered reader using FooterSkipBufferedReader(Reader, int, int) that will skip a specified number of rows at the end, using the default buffer size of DEFAULT_BUFFER_SIZE.
      Parameters:
      in - The InputStreamReader from which the buffered reader will read
      skipFooterLines - How many lines to skip at the end of processing
    • FooterSkipBufferedReader

      public FooterSkipBufferedReader(@NotNull @NotNull Reader in, int skipFooterLines, int bufferSize)
      Creates a buffered reader that will skip a specified number of rows at the end, using the specified buffer size.
      Parameters:
      in - The InputStreamReader from which the buffered reader will read
      skipFooterLines - How many lines to skip at the end of processing
      bufferSize - Size in characters (ints) of the buffer to use when reading the stream; this must be at least large enough to contain the entirety of the rows to be skipped.
  • Method Details

    • getDefaultBufferSize

      public static int getDefaultBufferSize()
      Returns the default buffer size, in characters, that will be used if no size is specified when the reader is created
      Returns:
      int value of the DEFAULT_BUFFER_SIZE defined for the class
    • read

      public int read(char @NotNull [] cbuf, int off, int len) throws IOException
      Overrides:
      read in class BufferedReader
      Throws:
      IOException
    • read

      public int read() throws IOException
      Reads a single character up to the lines to be skipped as specified in the constructor.
      Overrides:
      read in class BufferedReader
      Returns:
      The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached
      Throws:
      IOException - If an I/O error occurs
    • readLine

      public String readLine() throws IOException
      Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), a carriage return followed immediately by a line feed, or by reaching the end-of-file (EOF).
      Overrides:
      readLine in class BufferedReader
      Returns:
      A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached without reading any characters
      Throws:
      IOException - If an I/O error occurs
      See Also:
    • skip

      public long skip(long n)
      Unsupported by the FooterSkipBufferedReader
      Overrides:
      skip in class BufferedReader
    • markSupported

      public boolean markSupported()
      Tells whether this stream supports the mark() operation, which it does not.
      Overrides:
      markSupported in class BufferedReader
    • mark

      public void mark(int readAheadLimit)
      Unsupported by the FooterSkipBufferedReader
      Overrides:
      mark in class BufferedReader
    • reset

      public void reset()
      Unsupported by the FooterSkipBufferedReader
      Overrides:
      reset in class BufferedReader
    • lines

      public Stream<String> lines()
      Unsupported by the FooterSkipBufferedReader
      Overrides:
      lines in class BufferedReader