本文整理匯總了PHP中Streams::readAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Streams::readAll方法的具體用法?PHP Streams::readAll怎麽用?PHP Streams::readAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Streams
的用法示例。
在下文中一共展示了Streams::readAll方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: entryContent
/**
* Returns entry content
*
* @param io.archive.zip.ZipEntry entry
* @return string
*/
protected function entryContent(ZipEntry $entry)
{
if ($entry->isDirectory()) {
return NULL;
} else {
return (string) Streams::readAll($entry->getInputStream());
}
}
示例2: getData
/**
* Retrieve string representation of part
*
* @return string
*/
public function getData()
{
$bytes = Streams::readAll($this->stream);
// Create headers
$headers = '';
$headers .= 'Content-Disposition: form-data; name="' . $this->name . '"; filename="' . $this->filename . '"' . self::CRLF;
$headers .= 'Content-Type: ' . $this->contentType . self::CRLF;
$headers .= 'Content-Length: ' . strlen($bytes) . self::CRLF;
// Return payload
return $headers . self::CRLF . $bytes;
}
示例3: assertSecuredEntriesIn
/**
* Assertion helper
*
* @param io.archive.zip.ZipArchiveReader reader
* @throws unittest.AssertionFailedError
*/
protected function assertSecuredEntriesIn($reader)
{
with($it = $reader->usingPassword('secret')->iterator());
$entry = $it->next();
$this->assertEquals('password.txt', $entry->getName());
$this->assertEquals(15, $entry->getSize());
$this->assertEquals('Secret contents', (string) Streams::readAll($entry->getInputStream()));
$entry = $it->next();
$this->assertEquals('very.txt', $entry->getName());
$this->assertEquals(20, $entry->getSize());
$this->assertEquals('Very secret contents', (string) Streams::readAll($entry->getInputStream()));
}
示例4: content
/**
* Get data
*
* @return string
*/
public function content()
{
return Streams::readAll($this->input);
}
示例5: readAll_propagates_exception
public function readAll_propagates_exception()
{
Streams::readAll(new class implements InputStream
{
public function read($limit = 8192)
{
throw new IOException('FAIL');
}
public function available()
{
return 1;
}
public function close()
{
}
});
}
示例6: getInputStreams
public function getInputStreams()
{
$this->conn->connect();
$dir = $this->conn->rootDir()->getDir('htdocs');
for ($i = 0; $i < 2; $i++) {
try {
$s = $dir->getFile('index.html')->getInputStream();
$this->assertEquals("<html/>\n", Streams::readAll($s));
} catch (IOException $e) {
$this->fail('Round ' . ($i + 1), $e, NULL);
}
}
}
示例7: readAllWithException
public function readAllWithException()
{
Streams::readAll(newinstance('io.streams.InputStream', array(), '{
public function read($limit= 8192) { throw new IOException("FAIL"); }
public function available() { return 1; }
public function close() { }
}'));
}