Commit 8c8190cd authored by Sebastian Kummer's avatar Sebastian Kummer

Merge commit 'bb60677f' into...

Merge commit 'bb60677f' into feature/ZP-705-implement-support-for-streamer_type_stream_asplain
parents 6a48f14e bb60677f
......@@ -96,6 +96,27 @@ class MAPIStreamWrapper {
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
*
......
......@@ -315,10 +315,11 @@ class WBXMLEncoder extends WBXMLDefs {
private function _contentStream($stream, $asBase64) {
// write full stream, including the finalizing terminator to the output stream (stuff outTermStr() would do)
$this->outByte(WBXML_STR_I);
fseek($stream, 0, SEEK_SET);
if ($asBase64) {
$out_filter = stream_filter_append($this->_out, 'convert.base64-encode');
}
stream_copy_to_stream($stream, $this->_out);
$written = stream_copy_to_stream($stream, $this->_out);
if ($asBase64) {
stream_filter_remove($out_filter);
}
......@@ -326,7 +327,7 @@ class WBXMLEncoder extends WBXMLDefs {
// data is out, do some logging
$stat = fstat($stream);
$logContent = sprintf("<<< %d bytes of %s data >>>", $stat['size'], $asBase64 ? "base64 encoded":"plain");
$logContent = sprintf("<<< written %d of %d bytes of %s data >>>", $written, $stat['size'], $asBase64 ? "base64 encoded":"plain");
$this->logContent($logContent);
// 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