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

Public Member Functions

 __construct ($string)
 
 __destruct ()
 
 readBytes ($byteCount)
 
 readAllBytes ()
 
 __toString ()
 
- Public Member Functions inherited from Zend_Pdf_FileParserDataSource
 __destruct ()
 
 readBytes ($byteCount)
 
 readAllBytes ()
 
 __toString ()
 
 getOffset ()
 
 getSize ()
 
 moveToOffset ($offset)
 
 skipBytes ($byteCount)
 

Protected Attributes

 $_string = ''
 
- Protected Attributes inherited from Zend_Pdf_FileParserDataSource
 $_size = 0
 
 $_offset = 0
 

Detailed Description

Definition at line 35 of file String.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $string)

Object constructor.

Verifies that the string is not empty.

Parameters
string$stringString to parse.

Definition at line 60 of file String.php.

61  {
62  if (empty($string)) {
63  #require_once 'Zend/Pdf/Exception.php';
64  throw new Zend_Pdf_Exception('String is empty',
66  }
67  $this->_size = strlen($string);
68  $this->_string = $string;
69  }
const PARAMETER_VALUE_OUT_OF_RANGE
Definition: Exception.php:89

◆ __destruct()

__destruct ( )

Object destructor.

Definition at line 74 of file String.php.

75  {
76  $this->_string = '';
77  }

Member Function Documentation

◆ __toString()

__toString ( )

Returns a string containing the parsed string's length.

Returns
string

Definition at line 124 of file String.php.

125  {
126  return "String ($this->_size bytes)";
127  }

◆ readAllBytes()

readAllBytes ( )

Returns the entire string.

Preserves the current read position.

Returns
string

Definition at line 111 of file String.php.

112  {
113  return $this->_string;
114  }

◆ readBytes()

readBytes (   $byteCount)

Returns the specified number of raw bytes from the string at the byte offset of the current read position.

Advances the read position by the number of bytes read.

Throws an exception if there is insufficient data to completely fulfill the request.

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

Definition at line 92 of file String.php.

93  {
94  if (($this->_offset + $byteCount) > $this->_size) {
95  #require_once 'Zend/Pdf/Exception.php';
96  throw new Zend_Pdf_Exception("Insufficient data to read $byteCount bytes",
98  }
99  $bytes = substr($this->_string, $this->_offset, $byteCount);
100  $this->_offset += $byteCount;
101  return $bytes;
102  }

Field Documentation

◆ $_string

$_string = ''
protected

Definition at line 44 of file String.php.


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