Method: (LOAD-BUFFER BUFFER T T)

Source

(defmethod load-buffer ((buffer buffer) stream nr-octets
                        &key file-position eof-error-p)
  (with-slots (contents)
      buffer
    ;; If the buffer isn't big enough, make a bigger buffer.
    ;; We can't use LENGTH instead of ARRAY-DIMENSION, because
    ;; LENGTH looks at the fill pointer instead of the entire
    ;; buffer.
    (when (< (array-dimension contents 0) nr-octets)
      (setf contents
            (make-array nr-octets
                        :adjustable t
                        :fill-pointer 0
                        :element-type '(unsigned-byte 8))))
    ;;
    (when file-position
      (file-position stream file-position))
    (setf (fill-pointer contents) nr-octets)
    (when (and (< (read-sequence contents stream :end nr-octets) nr-octets)
               eof-error-p)
      (error "Unexpected end of file while loading a buffer of ~D octets."
             nr-octets)))
  buffer)
Source Context