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
TextFileParser which reads a single text file.
-
Field Summary
Fields inherited from class htsjdk.samtools.util.AbstractIterator
next
-
Constructor Summary
ConstructorsConstructorDescriptionBasicInputParser
(boolean treatGroupedDelimitersAsOne, int wordCount, File... files) Constructor.BasicInputParser
(boolean treatGroupedDelimitersAsOne, int wordCount, InputStream... inputStreams) BasicInputParser
(boolean treatGroupedDelimitersAsOne, File... files) Constructor.BasicInputParser
(boolean treatGroupedDelimitersAsOne, InputStream... inputStreams) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
close()
Closes the underlying streamProvides access to the current (just parsed) line in pre-parsed format.int
NOTE: Because AbstractInputParser pre-fetches the next line, this method actually returns the next line, not the most recent line returned by next().Gets the name of the file being parsedprotected byte[]
Workhorse method that reads the next line from the underlying readerMethods 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 htsjdk.samtools.util.CloseableIterator
stream, toList
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Constructor Details
-
BasicInputParser
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
Constructor. Opens up a buffered reader and reads the first line.- Parameters:
files
- the file(s) to parse, in order
-
BasicInputParser
Constructor. In addition to opening and priming the files, it sets the number of whitespace-separated "words" per line.- Parameters:
wordCount
- number of whitespace-separated "words" per linefiles
- the file(s) to parse
-
-
Method Details
-
readNextLine
protected byte[] readNextLine()Workhorse method that reads the next line from the underlying reader- Specified by:
readNextLine
in classAbstractInputParser
- 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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfacehtsjdk.samtools.util.CloseableIterator<String[]>
- Specified by:
close
in classAbstractInputParser
-
getFileName
Gets the name of the file being parsed- Specified by:
getFileName
in classAbstractInputParser
- Returns:
- the name of the file being parsed
-
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().
-