class PDF::Reader::Buffer
def read(bytes, opts = {})
This is because the data may start with LF.
Skipping a bare CR is not spec-compliant.
Note:
that is sitting under the io cursor.
:skip_eol - if true, the IO stream is advanced past a CRLF, CR or LF
options:
bytes - the number of bytes to read
return raw bytes from the underlying IO stream.
def read(bytes, opts = {}) reset_pos if opts[:skip_eol] @io.seek(-1, IO::SEEK_CUR) str = @io.read(2) if str.nil? return nil elsif str == CRLF # This MUST be done before checking for CR alone # do nothing elsif str[0, 1] == LF || str[0, 1] == CR # LF or CR alone @io.seek(-1, IO::SEEK_CUR) else @io.seek(-2, IO::SEEK_CUR) end end bytes = @io.read(bytes) save_pos bytes end