Java BufferedReader Methods
BufferedReader Methods
The BufferedReader
class provides methods to read text efficiently:
Method | Description | Return Type |
---|---|---|
close() | Closes the stream and releases system resources | void |
mark(int readAheadLimit) | Marks the current position in the stream | void |
markSupported() | Checks if mark() and reset() are supported |
boolean |
read() | Reads a single character | int |
read(char[] cbuf) read(char[] cbuf, int off, int len) |
Reads characters into an array or a portion of an array | int |
readLine() | Reads one full line of text | String |
ready() | Checks if the stream is ready to be read | boolean |
reset() | Resets the stream to the last marked position | void |
skip(long n) | Skips over characters in the stream | long |
lines() | Returns a Stream<String> of all lines |
Stream<String> |
transferTo(Writer out) | Reads all characters and writes them to the given writer | long |