Buffered Reader¶
Import: import system.io;
BufferedReader¶
Reads ahead from a borrowed reader without closing it; use this wrapper for positioning while buffered bytes remain, or recover them before accessing the source directly.
constructor¶
Wraps source with an 8 KiB default buffer; nonpositive sizes fail on reads.
read¶
Returns up to max_bytes from buffered input, refilling as needed; may return fewer. Zero is a no-op, negative sizes are invalid, and empty success for positive sizes is EOF.
read_line¶
Returns a line without LF or CRLF, preserving standalone CR and final unterminated lines. Returns None at EOF; ELIMIT consumes the prefix and exceeding byte when the pre-LF byte count exceeds max_bytes (default 1 MiB, including any CR).
seek¶
Seeks the source and discards buffered input only after success. Unsupported or failed seeks preserve unread buffered bytes.
tell¶
Returns the source position minus unread buffered bytes; propagates positioning errors.
take_buffered¶
Copies and removes unread buffered bytes without repositioning the source. Recover these bytes before bypassing this wrapper to access the source directly.