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 voidvoidclose()Closes the underlying streamProvides access to the current (just parsed) line in pre-parsed format.intNOTE: 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, setWordCountMethods inherited from class htsjdk.samtools.util.AbstractIterator
hasNext, isIterating, next, peek, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface htsjdk.samtools.util.CloseableIterator
stream, toListMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods 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:
readNextLinein 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfacehtsjdk.samtools.util.CloseableIterator<String[]>- Specified by:
closein classAbstractInputParser
-
getFileName
Gets the name of the file being parsed- Specified by:
getFileNamein 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().
-