Abstract Class 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) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)

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


	
			
Direct descendents
Class Description
 class Zend_Pdf_FileParserDataSource_File Concrete subclass of Zend_Pdf_FileParserDataSource that provides an interface to filesystem objects.
 class 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:
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:
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:
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:
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:
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:

Documentation generated on Thu, 18 Jan 2007 09:53:39 -0800 by phpDocumentor 1.3.1