本文整理汇总了PHP中WindowsAzure\Common\Internal\Utilities::stringToStream方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::stringToStream方法的具体用法?PHP Utilities::stringToStream怎么用?PHP Utilities::stringToStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowsAzure\Common\Internal\Utilities
的用法示例。
在下文中一共展示了Utilities::stringToStream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Creates GetBlobResult from getBlob call.
*
* @param array $headers The HTTP response headers.
* @param string $body The response body.
* @param array $metadata The blob metadata.
*
* @return GetBlobResult
*/
public static function create($headers, $body, $metadata)
{
$result = new GetBlobResult();
$result->setContentStream(Utilities::stringToStream($body));
$result->setProperties(BlobProperties::create($headers));
$result->setMetadata(is_null($metadata) ? array() : $metadata);
return $result;
}
示例2: testStringToStream
/**
* @covers WindowsAzure\Common\Internal\Utilities::stringToStream
*/
public function testStringToStream()
{
$data = 'This is string';
$expected = fopen('data://text/plain,' . $data, 'r');
// Test
$actual = Utilities::stringToStream($data);
// Assert
$this->assertEquals(stream_get_contents($expected), stream_get_contents($actual));
}
示例3: testSetContentStream
/**
* @covers WindowsAzure\Blob\Models\GetBlobResult::setContentStream
* @covers WindowsAzure\Blob\Models\GetBlobResult::getContentStream
*/
public function testSetContentStream()
{
// Setup
$expected = Utilities::stringToStream('0x8CAFB82EFF70C46');
$result = new GetBlobResult();
// Test
$result->setContentStream($expected);
// Assert
$this->assertEquals($expected, $result->getContentStream());
}