本文整理匯總了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");
}
}