ZF-19: Binary file parser class for Zend_Pdf
PDF documents may contain large binary files such as TIFF, JPEG, or PNG images and TrueType fonts. Including these files inside the PDF document requires that they first be parsed and certain data extracted from them so that an appropriate information dictionary can be constructed.
Currently, the object constructor methods for each of these binary types are written to read and deal directly with filesystem objects using the traditional fopen(), fread(), unpack() and similar functions.
This does not allow them to use data from other sources, such as in-memory images generated by GD, without first writing the data to a temporary file on disk. Additionally, many of the primitive parser functions, such as extracting a four byte unsigned integer, must be re-implemented in each class. Finally, the robust error-handling code necessary for interacting with the filesystem clutters the actual parser code, making it more difficult to follow.
Build an abstract file parser class for use by these objects with the following functionality: