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.

- - ### Field Summary

    - ### Fields inherited from class htsjdk.samtools.util.AbstractIterator

      `next`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicInputParser(boolean treatGroupedDelimitersAsOne, File... files)` Constructor.
    `BasicInputParser(boolean treatGroupedDelimitersAsOne, InputStream... inputStreams)` Constructor.
    `BasicInputParser(boolean treatGroupedDelimitersAsOne, int wordCount, File... files)` Constructor.
    `BasicInputParser(boolean treatGroupedDelimitersAsOne, int wordCount, InputStream... inputStreams)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `advanceFile()`
    `void` | `close()` Closes the underlying stream
    `String` | `getCurrentLine()` Provides access to the current (just parsed) line in pre-parsed format.
    `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().
    `String` | `getFileName()` Gets the name of the file being parsed
    `protected byte[]` | `readNextLine()` Workhorse method that reads the next line from the underlying reader

    - ### Methods inherited from class picard.util.AbstractInputParser

      `advance, calculateWordCount, getWordCount, isBlank, isComment, isDelimiter, isSkipBlankLines, isTreatGroupedDelimitersAsOne, iterator, setSkipBlankLines, setTreatGroupedDelimitersAsOne, setWordCount`

    - ### Methods inherited from class htsjdk.samtools.util.AbstractIterator

      `hasNext, isIterating, next, peek, remove`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

    - ### Methods inherited from interface htsjdk.samtools.util.CloseableIterator

      `stream, toList`

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining, hasNext, next, remove`

- - ### Constructor Detail

    - #### 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 Detail

    - #### 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 `htsjdk.samtools.util.CloseableIterator<String[]>`
      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      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().