# Class BufferedLineReader

java.lang.Object
java.io.Reader
java.io.BufferedReader
java.io.LineNumberReader
htsjdk.samtools.util.BufferedLineReader

All Implemented Interfaces:
  `LineReader, Closeable, AutoCloseable, Readable`

Direct Known Subclasses:
  `StringLineReader`

public class BufferedLineReader extends LineNumberReader implements LineReader
Implementation of LineReader that is a thin wrapper around BufferedReader. On Linux, this is faster than AsciiLineReaderImpl. If you use AsciiLineReader rather than this class, it will detect the OS and delegate to the preferred implementation.

## Field Summary

### Fields inherited from class Reader

`lock`

### Fields inherited from interface LineReader

`EOF_VALUE`

## Constructor Summary

Constructors
Constructor
Description
`BufferedLineReader(InputStream is)`
`BufferedLineReader(InputStream is, int bufferSize)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`static BufferedLineReader`
`fromString(String s)`
Returns a `BufferedLineReader` that gets its input from a String.
`int`
`peek()`
Non-destructive one-character look-ahead.
`String`
`readLine()`
Read a line and remove the line terminator

### Methods inherited from class LineNumberReader

`getLineNumber, mark, read, read, reset, setLineNumber, skip`

### Methods inherited from class BufferedReader

`lines, markSupported, ready`

### Methods inherited from class Reader

`nullReader, of, read, read, readAllAsString, readAllLines, transferTo`

### Methods inherited from class Object

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

### Methods inherited from interface LineReader

`getLineNumber`

## Constructor Details

### BufferedLineReader

public BufferedLineReader(InputStream is)

### BufferedLineReader

public BufferedLineReader(InputStream is, int bufferSize)

## Method Details

### fromString

public static BufferedLineReader fromString(String s)
Returns a `BufferedLineReader` that gets its input from a String. No charset conversion is necessary because the String is in unicode.

### readLine

public String readLine()
Read a line and remove the line terminator

Specified by:
  `readLine` in interface `LineReader`
Overrides:
  `readLine` in class `LineNumberReader`
Returns:
  the line read, or null if EOF has been reached.

### peek

public int peek()
Non-destructive one-character look-ahead.

Specified by:
  `peek` in interface `LineReader`
Returns:
  If not eof, the next character that would be read. If eof, -1.

### close

public void close()

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `LineReader`
Overrides:
  `close` in class `BufferedReader`