Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FileParserDataSource.php
Go to the documentation of this file.
1 <?php
42 {
43  /**** Instance Variables ****/
44 
45 
50  protected $_size = 0;
51 
56  protected $_offset = 0;
57 
58 
59 
60  /**** Public Interface ****/
61 
62 
63  /* Abstract Methods */
64 
70  abstract public function __destruct();
71 
86  abstract public function readBytes($byteCount);
87 
98  abstract public function readAllBytes();
99 
100 
101  /* Object Magic Methods */
102 
111  public function __toString()
112  {
113  return get_class($this);
114  }
115 
116 
117  /* Accessors */
118 
125  public function getOffset()
126  {
127  return $this->_offset;
128  }
129 
135  public function getSize()
136  {
137  return $this->_size;
138  }
139 
140 
141  /* Primitive Methods */
142 
156  public function moveToOffset($offset)
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  }
173 
185  public function skipBytes($byteCount)
186  {
187  $this->moveToOffset($this->_offset + $byteCount);
188  }
189 }
const MOVE_BEYOND_END_OF_FILE
Definition: Exception.php:152
const MOVE_BEFORE_START_OF_FILE
Definition: Exception.php:146