Package picard.util

Class BasicInputParser

java.lang.Object
htsjdk.samtools.util.AbstractIterator<String[]>
picard.util.AbstractInputParser
picard.util.BasicInputParser
All Implemented Interfaces:
htsjdk.samtools.util.CloseableIterator<String[]>, Closeable, AutoCloseable, Iterable<String[]>, Iterator<String[]>
Direct Known Subclasses:
CsvInputParser, TabbedInputParser

public class BasicInputParser extends AbstractInputParser
TextFileParser which reads a single text file.
  • Constructor Details

    • BasicInputParser

      public BasicInputParser(boolean treatGroupedDelimitersAsOne, InputStream... inputStreams)
      Constructor. Opens up a buffered reader and reads the first line.
      Parameters:
      inputStreams - the file(s) to parse, in order
    • BasicInputParser

      public BasicInputParser(boolean treatGroupedDelimitersAsOne, int wordCount, InputStream... inputStreams)
    • BasicInputParser

      public BasicInputParser(boolean treatGroupedDelimitersAsOne, File... files)
      Constructor. Opens up a buffered reader and reads the first line.
      Parameters:
      files - the file(s) to parse, in order
    • BasicInputParser

      public BasicInputParser(boolean treatGroupedDelimitersAsOne, int wordCount, File... files)
      Constructor. In addition to opening and priming the files, it sets the number of whitespace-separated "words" per line.
      Parameters:
      files - the file(s) to parse
      wordCount - number of whitespace-separated "words" per line
  • Method Details

    • readNextLine

      protected byte[] readNextLine()
      Workhorse method that reads the next line from the underlying reader
      Specified by:
      readNextLine in class AbstractInputParser
      Returns:
      String or null if there is no next line
    • advanceFile

      protected void advanceFile()
    • close

      public void close()
      Closes the underlying stream
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface htsjdk.samtools.util.CloseableIterator<String[]>
      Specified by:
      close in class AbstractInputParser
    • getFileName

      public String getFileName()
      Gets the name of the file being parsed
      Specified by:
      getFileName in class AbstractInputParser
      Returns:
      the name of the file being parsed
    • getCurrentLine

      public String getCurrentLine()
      Provides access to the current (just parsed) line in pre-parsed format. NOTE: Because AbstractInputParser pre-fetches the next line, this method actually returns the next line, not the most recent line returned by next().
    • getCurrentLineNumber

      public int getCurrentLineNumber()
      NOTE: Because AbstractInputParser pre-fetches the next line, this method actually returns the next line, not the most recent line returned by next().