public function getBinaryStream($path)
{
$path = $this->encodeAndValidatePathForDavex($path);
$request = $this->getRequest(Request::GET, $path);
$curl = $request->execute(true);
switch ($curl->getHeader('Content-Type')) {
case 'text/xml; charset=utf-8':
case 'text/xml;charset=utf-8':
return $this->decodeBinaryDom($curl->getResponse());
case 'jcr-value/binary;charset=utf-8':
case 'jcr-value/binary; charset=utf-8':
// TODO: OPTIMIZE stream handling!
$stream = fopen('php://memory', 'rwb+');
fwrite($stream, $curl->getResponse());
rewind($stream);
return $stream;
}
throw new RepositoryException('Unknown encoding of binary data: ' . $curl->getHeader('Content-Type'));
}