lib/pdf/reader/buffer.rb
# return raw bytes from the underlying IO stream.
#
#   bytes - the number of bytes to read
#
# options:
#
#   :skip_eol - if true, the IO stream is advanced past a CRLF, CR or LF
#               that is sitting under the io cursor.
#
return raw bytes from the underlying IO stream.
bytes - the number of bytes to read



:skip_eol - if true, the IO stream is advanced past a CRLF, CR or LF
that is sitting under the io cursor.
return raw bytes from the underlying IO stream . bytes - the number of bytes to read : skip_eol - if true the IO stream is advanced past a CRLF CR or LF that is sitting under the io cursor .
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 == "\r\n"
        elsif str[0,1] == "\n" || str[0,1] == "\r"
          @io.seek(-1, IO::SEEK_CUR)
        else
          @io.seek(-2, IO::SEEK_CUR)
        end
      end
      bytes = @io.read(bytes)
      save_pos
      bytes
    end
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 == "\r\n" elsif str [ 0 , 1 ] == "\n" || str [ 0 , 1 ] == "\r" @io . seek ( - 1 , IO :: SEEK_CUR ) else @io . seek ( - 2 , IO :: SEEK_CUR ) end end bytes = @io . read ( bytes ) save_pos bytes end
return raw bytes from the underlying IO stream.
return raw bytes from the underlying IO stream .
# do nothing
bytes
opts