Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Zend_Pdf_FileParserDataSource Class Reference
Inheritance diagram for Zend_Pdf_FileParserDataSource:
Zend_Pdf_FileParserDataSource_File Zend_Pdf_FileParserDataSource_String

Public Member Functions

 __destruct ()
 
 readBytes ($byteCount)
 
 readAllBytes ()
 
 __toString ()
 
 getOffset ()
 
 getSize ()
 
 moveToOffset ($offset)
 
 skipBytes ($byteCount)
 

Protected Attributes

 $_size = 0
 
 $_offset = 0
 

Detailed Description

Definition at line 41 of file FileParserDataSource.php.

Constructor & Destructor Documentation

◆ __destruct()

__destruct ( )
abstract

Object destructor. Closes the data source.

May also perform cleanup tasks such as deleting temporary files.

Member Function Documentation

◆ __toString()

__toString ( )

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.

Returns
string

Definition at line 111 of file FileParserDataSource.php.

112  {
113  return get_class($this);
114  }

◆ getOffset()

getOffset ( )

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

Returns
integer

Definition at line 125 of file FileParserDataSource.php.

◆ getSize()

getSize ( )

Returns the total size in bytes of the data source.

Returns
integer

Definition at line 135 of file FileParserDataSource.php.

136  {
137  return $this->_size;
138  }

◆ moveToOffset()

moveToOffset (   $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.

Parameters
integer$offsetDestination byte offset.
Exceptions
Zend_Pdf_Exception

Definition at line 156 of file FileParserDataSource.php.

157  {
158  if ($this->_offset == $offset) {
159  return; // Not moving; do nothing.
160  }
161  if ($offset < 0) {
162  #require_once 'Zend/Pdf/Exception.php';
163  throw new Zend_Pdf_Exception('Attempt to move before start of data source',
165  }
166  if ($offset >= $this->_size) { // Offsets are zero-based.
167  #require_once 'Zend/Pdf/Exception.php';
168  throw new Zend_Pdf_Exception('Attempt to move beyond end of data source',
170  }
171  $this->_offset = $offset;
172  }
const MOVE_BEYOND_END_OF_FILE
Definition: Exception.php:152
const MOVE_BEFORE_START_OF_FILE
Definition: Exception.php:146

◆ readAllBytes()

readAllBytes ( )
abstract

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.

Returns
string

◆ readBytes()

readBytes (   $byteCount)
abstract

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.

Parameters
integer$byteCountNumber of bytes to read.
Returns
string
Exceptions
Zend_Pdf_Exception

◆ skipBytes()

skipBytes (   $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.

Parameters
integer$byteCountNumber of bytes to skip.
Exceptions
Zend_Pdf_Exception

Definition at line 185 of file FileParserDataSource.php.

186  {
187  $this->moveToOffset($this->_offset + $byteCount);
188  }

Field Documentation

◆ $_offset

$_offset = 0
protected

Definition at line 56 of file FileParserDataSource.php.

◆ $_size

$_size = 0
protected

Definition at line 50 of file FileParserDataSource.php.


The documentation for this class was generated from the following file: