## Zend_Pdf_FileParserDataSource

Description

Abstract helper class for Zend_Pdf_FileParser that provides the data source for parsing.

Concrete subclasses allow for parsing of in-memory, filesystem, and other sources through a common API. These subclasses also take care of error handling and other mundane tasks.

Subclasses must implement at minimum __construct(), __destruct(), readBytes(), and readAllBytes(). Subclasses should also override moveToOffset() and __toString() as appropriate.

- abstract:
- license: New BSD License
- copyright: Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Pdf/FileParserDataSource.php (line 43)

Direct descendents

Class | Description
--- | ---
Zend_Pdf_FileParserDataSource_File | Concrete subclass of Zend_Pdf_FileParserDataSource that provides an interface to filesystem objects.
Zend_Pdf_FileParserDataSource_String | Concrete subclass of Zend_Pdf_FileParserDataSource that provides an interface to binary strings.

Variable Summary
integer $_offset
integer $_size
Method Summary
Zend_Pdf_FileParserDataSource __construct ()
void __destruct ()
integer getOffset ()
integer getSize ()
void moveToOffset (integer $offset)
string readAllBytes ()
string readBytes (integer $byteCount)
void skipBytes (integer $byteCount)
string __toString ()
Variables
integer $_offset = 0 (line 58)

Byte offset of the current read position within the data source.

- access: protected

integer $_size = 0 (line 52)

Total size in bytes of the data source.

- access: protected

Methods
Constructor __construct (line 80)

Object constructor. Opens the data source for parsing.

Must set $this->_size to the total size in bytes of the data source.

Upon return the data source can be interrogated using the primitive methods described here.

If the data source cannot be opened for any reason (such as insufficient permissions, missing file, etc.), will throw an appropriate exception.

- access: public
- abstract:
- throws: Zend_Pdf_Exception

Zend_Pdf_FileParserDataSource __construct ()

Redefined in descendants as:

- Zend_Pdf_FileParserDataSource_File::__construct() : Object constructor.
- Zend_Pdf_FileParserDataSource_String::__construct() : Object constructor.

Destructor __destruct (line 87)

Object destructor. Closes the data source.

May also perform cleanup tasks such as deleting temporary files.

- access: public
- abstract:

void __destruct ()

Redefined in descendants as:

- Zend_Pdf_FileParserDataSource_File::__destruct() : Object destructor.
- Zend_Pdf_FileParserDataSource_String::__destruct() : Object destructor.

getOffset (line 142)

Returns the byte offset of the current read position within the data source.

- access: public

integer getOffset ()
getSize (line 152)

Returns the total size in bytes of the data source.

- access: public

integer getSize ()
moveToOffset (line 173)

Moves the current read position to the specified byte offset.

Throws an exception you attempt to move before the beginning or beyond the end of the data source.

If a subclass needs to perform additional tasks (such as performing a fseek() on a filesystem source), it should do so after calling this parent method.

- access: public
- throws: Zend_Pdf_Exception

void moveToOffset (integer $offset)

- integer $offset: Destination byte offset.

Redefined in descendants as:

- Zend_Pdf_FileParserDataSource_File::moveToOffset() : Seeks the file read position to the specified byte offset.

readAllBytes (line 115)

Returns the entire contents of the data source as a string.

This method may be called at any time and so must preserve the byte offset of the read position, both through $this->_offset and whatever other additional pointers (such as the seek position of a file pointer) that might be used.

- access: public
- abstract:

string readAllBytes ()

Redefined in descendants as:

- Zend_Pdf_FileParserDataSource_File::readAllBytes() : Returns the entire contents of the file as a string.
- Zend_Pdf_FileParserDataSource_String::readAllBytes() : Returns the entire string.

readBytes (line 103)

Returns the specified number of raw bytes from the data source at the byte offset of the current read position.

Must advance the read position by the number of bytes read by updating $this->_offset.

Throws an exception if there is insufficient data to completely fulfill the request or if an error occurs.

- access: public
- abstract:
- throws: Zend_Pdf_Exception

string readBytes (integer $byteCount)

- integer $byteCount: Number of bytes to read.

Redefined in descendants as:

- Zend_Pdf_FileParserDataSource_File::readBytes() : Returns the specified number of raw bytes from the file at the byte offset of the current read position.
- Zend_Pdf_FileParserDataSource_String::readBytes() : Returns the specified number of raw bytes from the string at the byte offset of the current read position.

skipBytes (line 200)

Shifts the current read position within the data source by the specified number of bytes.

You may move forward (positive numbers) or backward (negative numbers). Throws an exception you attempt to move before the beginning or beyond the end of the data source.

- access: public
- throws: Zend_Pdf_Exception

void skipBytes (integer $byteCount)

- integer $byteCount: Number of bytes to skip.

__toString (line 128)

Returns a description of the object for debugging purposes.

Subclasses should override this method to provide a more specific description of the actual object being represented.

- access: public

string __toString ()

Redefined in descendants as:

- Zend_Pdf_FileParserDataSource_File::__toString() : Returns the full filesystem path of the file.
- Zend_Pdf_FileParserDataSource_String::__toString() : Returns a string containing the parsed string's length.

Documentation generated on Tue, 11 Jul 2006 12:17:17 -0500 by phpDocumentor 1.3.0RC6