Package picard.util

# Class AbstractInputParser

java.lang.Object
htsjdk.samtools.util.AbstractIterator<String[]>
picard.util.AbstractInputParser

All Implemented Interfaces:
  `htsjdk.samtools.util.CloseableIterator<String[]>`, `Closeable`, `AutoCloseable`, `Iterable<String[]>`, `Iterator<String[]>`

Direct Known Subclasses:
  `BasicInputParser`

public abstract class AbstractInputParser extends htsjdk.samtools.util.AbstractIterator<String[]> implements Iterable<String[]>, htsjdk.samtools.util.CloseableIterator<String[]>
Class for parsing text files where each line consists of fields separated by whitespace. Code is abstracted into this class so that we can optimize its performance over time. This class assumes that every line will have the same number of whitespace-separated "words" and that lines that start with "#" are comments and should be ignored. Classes that extend this parser can do so simply by implementing their own constructors and the readNextLine(), close(), and getFileName() methods.

## Field Summary

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

`next`

## Constructor Summary

Constructors
Constructor
Description
`AbstractInputParser()`

## Method Summary

Modifier and Type
Method
Description
`protected String[]`
`advance()`
`protected void`
`calculateWordCount(byte[] line)`
Calculates the number of delimiter-separated "words" in a line and sets the value of `wordCount`
`abstract void`
`close()`
Closes this stream and releases any system resources associated with it.
`abstract String`
`getFileName()`
`protected int`
`getWordCount()`
`protected boolean`
`isBlank(byte[] line)`
Determines whether a given line is a comment
`protected boolean`
`isComment(byte[] line)`
Determines whether a given line is a comment
`protected boolean`
`isDelimiter(byte b)`
Determines whether a given character is a delimiter
`protected boolean`
`isSkipBlankLines()`
`protected boolean`
`isTreatGroupedDelimitersAsOne()`
`Iterator<String[]>`
`iterator()`
`protected abstract byte[]`
`readNextLine()`
`protected void`
`setSkipBlankLines(boolean skipBlankLines)`
`protected void`
`setTreatGroupedDelimitersAsOne(boolean treatGroupedDelimitersAsOne)`
`protected void`
`setWordCount(int wordCount)`

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

### AbstractInputParser

public AbstractInputParser()

## Method Details

### close

public abstract void close()
Closes this stream and releases any system resources associated with it.

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `htsjdk.samtools.util.CloseableIterator<String[]>`

### readNextLine

protected abstract byte[] readNextLine()

Returns:
  the next line of text from the underlying stream(s) or null if there is no next line

### getFileName

public abstract String getFileName()

Returns:
  the name(s) of the file(s) being parsed, or null if no name is available

### iterator

public Iterator<String[]> iterator()

Specified by:
  `iterator` in interface `Iterable<String[]>`
Returns:
  an iterator over a set of elements of type String[]

### advance

protected String[] advance()

Specified by:
  `advance` in class `htsjdk.samtools.util.AbstractIterator<String[]>`

### calculateWordCount

protected void calculateWordCount(byte[] line)
Calculates the number of delimiter-separated "words" in a line and sets the value of `wordCount`

Parameters:
  `line` - representative line from the file

### isComment

protected boolean isComment(byte[] line)
Determines whether a given line is a comment

Parameters:
  `line` - the line to evaluate
Returns:
  true if the line is a comment (and should be ignored) otherwise false

### isBlank

protected boolean isBlank(byte[] line)
Determines whether a given line is a comment

Parameters:
  `line` - the line to evaluate
Returns:
  true if the line is a comment (and should be ignored) otherwise false

### isDelimiter

protected boolean isDelimiter(byte b)
Determines whether a given character is a delimiter

Parameters:
  `b` - the character to evaluate
Returns:
  true if `b` is a delimiter; otherwise false

### getWordCount

protected int getWordCount()

### setWordCount

protected void setWordCount(int wordCount)

### isTreatGroupedDelimitersAsOne

protected boolean isTreatGroupedDelimitersAsOne()

### setTreatGroupedDelimitersAsOne

protected void setTreatGroupedDelimitersAsOne(boolean treatGroupedDelimitersAsOne)

### isSkipBlankLines

protected boolean isSkipBlankLines()

### setSkipBlankLines

protected void setSkipBlankLines(boolean skipBlankLines)