Zend Framework
1.12
|
Public Member Functions | |
screen () | |
Performs a cursory check to verify that the binary file is in the expected format. | |
parse () | |
Reads and parses the complete binary file. | |
__construct (Zend_Pdf_FileParserDataSource $dataSource) | |
Object constructor. | |
__destruct () | |
Object destructor. | |
isScreened () | |
Returns true if the file has passed a cursory validation check. | |
isParsed () | |
Returns true if the file has been successfully parsed. | |
getDataSource () | |
Returns the data source object representing the file being parsed. | |
moveToOffset ($offset) | |
Convenience wrapper for the data source object's moveToOffset() method. | |
getOffset () | |
getSize () | |
readBytes ($byteCount) | |
Convenience wrapper for the data source object's readBytes() method. | |
skipBytes ($byteCount) | |
Convenience wrapper for the data source object's skipBytes() method. | |
readInt ($size, $byteOrder=Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN) | |
Reads the signed integer value from the binary file at the current byte offset. | |
readUInt ($size, $byteOrder=Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN) | |
Reads the unsigned integer value from the binary file at the current byte offset. | |
isBitSet ($bit, $bitField) | |
Returns true if the specified bit is set in the integer bitfield. | |
readFixed ($mantissaBits, $fractionBits, $byteOrder=Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN) | |
Reads the signed fixed-point number from the binary file at the current byte offset. | |
readStringUTF16 ($byteCount, $byteOrder=Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN, $characterSet= '') | |
Reads the Unicode UTF-16-encoded string from the binary file at the current byte offset. | |
readStringMacRoman ($byteCount, $characterSet= '') | |
Reads the Mac Roman-encoded string from the binary file at the current byte offset. | |
readStringPascal ($characterSet= '', $lengthBytes=1) | |
Reads the Pascal string from the binary file at the current byte offset. | |
Public Attributes | |
const | BYTE_ORDER_LITTLE_ENDIAN = 0 |
Little-endian byte order (0x04 0x03 0x02 0x01). | |
const | BYTE_ORDER_BIG_ENDIAN = 1 |
Big-endian byte order (0x01 0x02 0x03 0x04). | |
Protected Attributes | |
$_isScreened = false | |
$_isParsed = false | |
$_dataSource = null | |
__construct | ( | Zend_Pdf_FileParserDataSource | $dataSource | ) |
Object constructor.
Verifies that the data source has been properly initialized.
Zend_Pdf_FileParserDataSource | $dataSource |
Zend_Pdf_Exception |
__destruct | ( | ) |
Object destructor.
Discards the data source object.
getDataSource | ( | ) |
Returns the data source object representing the file being parsed.
getOffset | ( | ) |
getSize | ( | ) |
isBitSet | ( | $bit, | |
$bitField | |||
) |
Returns true if the specified bit is set in the integer bitfield.
integer | $bit | Bit number to test (i.e. - 0-31) |
integer | $bitField |
isParsed | ( | ) |
Returns true if the file has been successfully parsed.
isScreened | ( | ) |
Returns true if the file has passed a cursory validation check.
moveToOffset | ( | $offset | ) |
Convenience wrapper for the data source object's moveToOffset() method.
integer | $offset | Destination byte offset. |
Zend_Pdf_Exception |
|
abstract |
Reads and parses the complete binary file.
Must set $this->_isParsed to true if successful.
Zend_Pdf_Exception |
readBytes | ( | $byteCount | ) |
Convenience wrapper for the data source object's readBytes() method.
integer | $byteCount | Number of bytes to read. |
Zend_Pdf_Exception |
readFixed | ( | $mantissaBits, | |
$fractionBits, | |||
$byteOrder = Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN |
|||
) |
Reads the signed fixed-point number from the binary file at the current byte offset.
Common fixed-point sizes are 2.14 and 16.16.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
integer | $mantissaBits | Number of bits in the mantissa |
integer | $fractionBits | Number of bits in the fraction |
integer | $byteOrder | (optional) Big- or little-endian byte order. Use the BYTE_ORDER_ constants defined in Zend_Pdf_FileParser. If omitted, uses big-endian. |
Zend_Pdf_Exception |
readInt | ( | $size, | |
$byteOrder = Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN |
|||
) |
Reads the signed integer value from the binary file at the current byte offset.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
integer | $size | Size of integer in bytes: 1-4 |
integer | $byteOrder | (optional) Big- or little-endian byte order. Use the BYTE_ORDER_ constants defined in Zend_Pdf_FileParser. If omitted, uses big-endian. |
Zend_Pdf_Exception |
readStringMacRoman | ( | $byteCount, | |
$characterSet = '' |
|||
) |
Reads the Mac Roman-encoded string from the binary file at the current byte offset.
You must supply the desired resulting character set.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
integer | $byteCount | Number of bytes (characters) to return. |
string | $characterSet | (optional) Desired resulting character set. You may use any character set supported by iconv(). If omitted, uses 'current locale'. |
Zend_Pdf_Exception |
readStringPascal | ( | $characterSet = '' , |
|
$lengthBytes = 1 |
|||
) |
Reads the Pascal string from the binary file at the current byte offset.
The length of the Pascal string is determined by reading the length bytes which preceed the character data. You must supply the desired resulting character set.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
string | $characterSet | (optional) Desired resulting character set. You may use any character set supported by iconv(). If omitted, uses 'current locale'. |
integer | $lengthBytes | (optional) Number of bytes that make up the length. Default is 1. |
Zend_Pdf_Exception |
readStringUTF16 | ( | $byteCount, | |
$byteOrder = Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN , |
|||
$characterSet = '' |
|||
) |
Reads the Unicode UTF-16-encoded string from the binary file at the current byte offset.
The byte order of the UTF-16 string must be specified. You must also supply the desired resulting character set.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
Consider changing $byteCount to a character count. They are not always equivalent (in the case of surrogates).
Make $byteOrder optional if there is a byte-order mark (BOM) in the string being extracted.
integer | $byteCount | Number of bytes (characters * 2) to return. |
integer | $byteOrder | (optional) Big- or little-endian byte order. Use the BYTE_ORDER_ constants defined in Zend_Pdf_FileParser. If omitted, uses big-endian. |
string | $characterSet | (optional) Desired resulting character set. You may use any character set supported by iconv(). If omitted, uses 'current locale'. |
Zend_Pdf_Exception |
readUInt | ( | $size, | |
$byteOrder = Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN |
|||
) |
Reads the unsigned integer value from the binary file at the current byte offset.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
NOTE: If you ask for a 4-byte unsigned integer on a 32-bit machine, the resulting value WILL BE SIGNED because PHP uses signed integers internally for everything. To guarantee portability, be sure to use bitwise operators operators on large unsigned integers!
integer | $size | Size of integer in bytes: 1-4 |
integer | $byteOrder | (optional) Big- or little-endian byte order. Use the BYTE_ORDER_ constants defined in Zend_Pdf_FileParser. If omitted, uses big-endian. |
Zend_Pdf_Exception |
|
abstract |
Performs a cursory check to verify that the binary file is in the expected format.
Intended to quickly weed out obviously bogus files.
Must set $this->_isScreened to true if successful.
Zend_Pdf_Exception |
skipBytes | ( | $byteCount | ) |
Convenience wrapper for the data source object's skipBytes() method.
integer | $byteCount | Number of bytes to skip. |
Zend_Pdf_Exception |
|
protected |
|
protected |
|
protected |
const BYTE_ORDER_BIG_ENDIAN = 1 |
Big-endian byte order (0x01 0x02 0x03 0x04).
const BYTE_ORDER_LITTLE_ENDIAN = 0 |
Little-endian byte order (0x04 0x03 0x02 0x01).