Class: PDF::Reader::Buffer

Class | PDF::Reader::Buffer
In: | lib/pdf/reader/buffer.rb
Parent: | Object

An internal PDF::Reader class that mediates access to the underlying PDF File or IO Stream

### Methods

eof? find_first_xref_offset head new pos pos_without_buf raw read read_until ready_token seek token

### Public Class methods

new(io)

Creates a new buffer around the specified IO object

### Public Instance methods

eof?()

returns true if the underlying IO object is at end and the internal buffer is empty

find_first_xref_offset()

The Xref table in a PDF file acts as an aid for finding the location of various objects in the file. This method attempts to locate the byte offset of the xref table in the underlying IO stream.

head(chars, with_strip=true)
pos()
pos_without_buf()
raw()

return the internal buffer used by this class when reading from the IO stream.

read(length)

reads the requested number of bytes from the underlying IO stream.

length should be a positive integer.

read_until(bytes)

Reads from the buffer until the specified token is found, or the end of the buffer

bytes - the bytes to search for.

ready_token(with_strip=true, skip_blanks=true)

PDF files are processed by tokenising the content into a series of objects and commands. This prepares the buffer for use by reading the next line of tokens into memory.

seek(offset)

Seek to the requested byte in the IO stream.

token()

return the next token from the underlying IO stream

[Validate]