API Documentation

Pdf/FileParserDataSource.php

Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Pdf
subpackage
FileParser
version
$Id: FileParserDataSource.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Pdf_FileParserDataSource

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Pdf_FileParserDataSource

copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Pdf
subpackage
FileParser
Properties
$_size
$_offset
Methods
__construct
__destruct
readBytes
readAllBytes
__toString
getOffset
getSize
moveToOffset
skipBytes

Description

Abstract helper class for {@link 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 {@link __construct()}, {@link __destruct()}, {@link readBytes()}, and {@link readAllBytes()}. Subclasses should also override {@link moveToOffset()} and {@link __toString()} as appropriate.

Properties

$_offset

integer $_offset = '0'

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

Details

$_offset
integer
visibility
protected
default
0
final
false
static
false

$_size

integer $_size = '0'

Total size in bytes of the data source.

Details

$_size
integer
visibility
protected
default
0
final
false
static
false

Methods

__construct

__construct( ) :

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.

Details
visibility
public
final
false
static
false
throws

__destruct

__destruct( ) :

Object destructor. Closes the data source.

May also perform cleanup tasks such as deleting temporary files.

Details
visibility
public
final
false
static
false

__toString

__toString( ) : string

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.

Output
string
Details
visibility
public
final
false
static
false

getOffset

getOffset( ) : integer

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

Output
integer
Details
visibility
public
final
false
static
false

getSize

getSize( ) : integer

Returns the total size in bytes of the data source.

Output
integer
Details
visibility
public
final
false
static
false

moveToOffset

moveToOffset( integer $offset ) :

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.

Arguments
$offset
integer
Destination byte offset.
Details
visibility
public
final
false
static
false
throws

readAllBytes

readAllBytes( ) : string

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.

Output
string
Details
visibility
public
final
false
static
false

readBytes

readBytes( integer $byteCount ) : string

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.

Arguments
$byteCount
integer
Number of bytes to read.
Output
string
Details
visibility
public
final
false
static
false
throws

skipBytes

skipBytes( integer $byteCount ) :

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.

Arguments
$byteCount
integer
Number of bytes to skip.
Details
visibility
public
final
false
static
false
throws
Documentation was generated by DocBlox.