BufferedReader
Note
This is a point-in-time snapshot of the API documentation from January 2026. Going forward, we will not be maintaining a public copy of these references, and recommend users to refer to the built-in signature helpers available in the Hack LSP instead for complete and up-to-date information.
Wrapper for ReadHandles, with buffered line-based byte-based accessors
readLineAsync()is similar tofgets()readUntilAsync()is a more general formreadByteAsync()is similar tofgetc()
Interface Synopsis
namespace HH\Lib\IO;
final class BufferedReader implements ReadHandle {...}
Public Methods
->__construct(ReadHandle $handle)->getHandle(): ReadHandle->isEndOfFile(): bool
If we are known to have reached the end of the file->linesIterator(): AsyncIterator<string>
Iterate over all lines in the file->readAllowPartialSuccessAsync(?int $max_bytes = NULL, ?int $timeout_ns = NULL): Awaitable<string>->readByteAsync(?int $timeout_ns = NULL): Awaitable<string>
Read a single byte from the handle->readFixedSizeAsync(int $size, ?int $timeout_ns = NULL): Awaitable<string>->readImpl(?int $max_bytes = NULL): string->readLineAsync(): Awaitable<?string>
Read until the platform end-of-line sequence is seen, or EOF is reached->readLinexAsync(): Awaitable<string>
Read a line or throw EPIPE->readUntilAsync(string $suffix): Awaitable<?string>
Read until the specified suffix is seen->readUntilxAsync(string $suffix): Awaitable<string>
Read until the suffix, or raise EPIPE if the separator is not seen
Public Methods (HH\Lib\IO\ReadHandle)
->readAllAsync(?int $max_bytes = NULL, ?int $timeout_ns = NULL): Awaitable<string>
Read until there is no more data to read