當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Streams::readAll方法代碼示例

本文整理匯總了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());
     }
 }
開發者ID:Gamepay,項目名稱:xp-framework,代碼行數:14,代碼來源:ZipFileContentsTest.class.php

示例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;
 }
開發者ID:melogamepay,項目名稱:xp-framework,代碼行數:16,代碼來源:FileUpload.class.php

示例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()));
 }
開發者ID:Gamepay,項目名稱:xp-framework,代碼行數:18,代碼來源:XpZipFileTest.class.php

示例4: content

 /**
  * Get data
  *
  * @return  string
  */
 public function content()
 {
     return Streams::readAll($this->input);
 }
開發者ID:melogamepay,項目名稱:xp-framework,代碼行數:9,代碼來源:RestResponse.class.php

示例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()
         {
         }
     });
 }
開發者ID:xp-framework,項目名稱:core,代碼行數:17,代碼來源:StreamWrappingTest.class.php

示例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);
         }
     }
 }
開發者ID:Gamepay,項目名稱:xp-framework,代碼行數:13,代碼來源:IntegrationTest.class.php

示例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() { }
   }'));
 }
開發者ID:Gamepay,項目名稱:xp-framework,代碼行數:8,代碼來源:StreamWrappingTest.class.php


注:本文中的Streams::readAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。