From 06f945f27840b53e57795dadbc38e76f7e11ab1c Mon Sep 17 00:00:00 2001 From: Horus3 Date: Mon, 24 Feb 2014 16:42:14 +0100 Subject: init --- zend/library/Zend/Gdata/MimeBodyString.php | 92 ++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 zend/library/Zend/Gdata/MimeBodyString.php (limited to 'zend/library/Zend/Gdata/MimeBodyString.php') diff --git a/zend/library/Zend/Gdata/MimeBodyString.php b/zend/library/Zend/Gdata/MimeBodyString.php new file mode 100644 index 0000000..d4ab5c3 --- /dev/null +++ b/zend/library/Zend/Gdata/MimeBodyString.php @@ -0,0 +1,92 @@ +_sourceString = $sourceString; + $this->_bytesRead = 0; + } + + /** + * Read the next chunk of the string. + * + * @param integer $bytesRequested The size of the chunk that is to be read. + * @return string A corresponding piece of the string. + */ + public function read($bytesRequested) + { + $len = strlen($this->_sourceString); + if($this->_bytesRead == $len) { + return FALSE; + } else if($bytesRequested > $len - $this->_bytesRead) { + $bytesRequested = $len - $this->_bytesRead; + } + + $buffer = substr($this->_sourceString, $this->_bytesRead, $bytesRequested); + $this->_bytesRead += $bytesRequested; + + return $buffer; + } + + /** + * The length of the string. + * + * @return int The length of the string contained in the object. + */ + public function getSize() + { + return strlen($this->_sourceString); + } + + +} -- cgit v1.2.3