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() | Marks the current position in the stream | void |
markSupported() | Checks if mark() and reset() are supported |
boolean |
read() | Reads a single character | int |
read() | 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() | Skips over characters in the stream | long |
lines() | Returns a Stream<String> of all lines |
Stream<String> |
transferTo() | Reads all characters and writes them to the given writer | long |