Commit bb60677f authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-702 Implement seeking capability to MAPIStreamWrapper. Add stream

size to log output.

Released under the Affero GNU General Public License (AGPL) version 3.
parent d656e5a8
...@@ -96,6 +96,27 @@ class MAPIStreamWrapper { ...@@ -96,6 +96,27 @@ class MAPIStreamWrapper {
return $data; return $data;
} }
/**
* Stream "seek" functionality.
*
* @param int $offset
* @param int $whence
* @return boolean
*/
public function stream_seek($offset, $whence = SEEK_SET) {
switch($whence) {
case SEEK_SET:
$mapiWhence = STREAM_SEEK_SET;
break;
case SEEK_END:
$mapiWhence = STREAM_SEEK_END;
break;
default:
$mapiWhence = STREAM_SEEK_CUR;
}
return mapi_stream_seek($this->mapistream, $offset, $mapiWhence);
}
/** /**
* Returns the current position on stream * Returns the current position on stream
* *
......
...@@ -326,7 +326,8 @@ class WBXMLEncoder extends WBXMLDefs { ...@@ -326,7 +326,8 @@ class WBXMLEncoder extends WBXMLDefs {
fwrite($this->_out, chr(0)); fwrite($this->_out, chr(0));
// data is out, do some logging // data is out, do some logging
$logContent = sprintf("<<< %d bytes of %s data >>>", $written, $asBase64 ? "base64 encoded":"plain"); $stat = fstat($stream);
$logContent = sprintf("<<< written %d of %d bytes of %s data >>>", $written, $stat['size'], $asBase64 ? "base64 encoded":"plain");
$this->logContent($logContent); $this->logContent($logContent);
// write the meta data also to the _outLog stream, WBXML_STR_I was already written by outByte() above // write the meta data also to the _outLog stream, WBXML_STR_I was already written by outByte() above
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment