本文整理汇总了PHP中Swift_InputByteStream::commit方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift_InputByteStream::commit方法的具体用法?PHP Swift_InputByteStream::commit怎么用?PHP Swift_InputByteStream::commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift_InputByteStream
的用法示例。
在下文中一共展示了Swift_InputByteStream::commit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyFromOpenSSLOutput
/**
* @param Swift_OutputByteStream $fromStream
* @param Swift_InputByteStream $toStream
*/
protected function copyFromOpenSSLOutput(Swift_OutputByteStream $fromStream, Swift_InputByteStream $toStream)
{
$bufferLength = 4096;
$filteredStream = new Swift_ByteStream_TemporaryFileByteStream();
$filteredStream->addFilter($this->replacementFactory->createFilter("\r\n", "\n"), 'CRLF to LF');
$filteredStream->addFilter($this->replacementFactory->createFilter("\n", "\r\n"), 'LF to CRLF');
while (false !== ($buffer = $fromStream->read($bufferLength))) {
$filteredStream->write($buffer);
}
$filteredStream->flushBuffers();
while (false !== ($buffer = $filteredStream->read($bufferLength))) {
$toStream->write($buffer);
}
$toStream->commit();
}
示例2: toByteStream
/**
* Write this entire entity to a {@see Swift_InputByteStream}.
*
* @param Swift_InputByteStream
*/
public function toByteStream(Swift_InputByteStream $is)
{
$is->write($this->_headers->toString());
$is->commit();
$this->_bodyToByteStream($is);
}
示例3: toByteStream
/**
* Write this entire entity to a {@see Swift_InputByteStream}.
*
* @param Swift_InputByteStream
*/
public function toByteStream(Swift_InputByteStream $is)
{
$is->write($this->_headers->toString());
$is->commit();
if (empty($this->_immediateChildren)) {
if (isset($this->_body)) {
if ($this->_cache->hasKey($this->_cacheKey, 'body')) {
$this->_cache->exportToByteStream($this->_cacheKey, 'body', $is);
} else {
$cacheIs = $this->_cache->getInputByteStream($this->_cacheKey, 'body');
if ($cacheIs) {
$is->bind($cacheIs);
}
$is->write("\r\n");
if ($this->_body instanceof Swift_OutputByteStream) {
$this->_body->setReadPointer(0);
$this->_encoder->encodeByteStream($this->_body, $is, 0, $this->getMaxLineLength());
} else {
$is->write($this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()));
}
if ($cacheIs) {
$is->unbind($cacheIs);
}
}
}
}
if (!empty($this->_immediateChildren)) {
foreach ($this->_immediateChildren as $child) {
$is->write("\r\n\r\n--" . $this->getBoundary() . "\r\n");
$child->toByteStream($is);
}
$is->write("\r\n\r\n--" . $this->getBoundary() . "--\r\n");
}
}