Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

StreamInterface.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 4.95 KiB


 001  <?php
 002  namespace GuzzleHttp\Stream;
 003   
 004  /**
 005   * Describes a stream instance.
 006   */
 007  interface StreamInterface
 008  {
 009      /**
 010       * Attempts to seek to the beginning of the stream and reads all data into
 011       * a string until the end of the stream is reached.
 012       *
 013       * Warning: This could attempt to load a large amount of data into memory.
 014       *
 015       * @return string
 016       */
 017      public function __toString();
 018   
 019      /**
 020       * Closes the stream and any underlying resources.
 021       */
 022      public function close();
 023   
 024      /**
 025       * Separates any underlying resources from the stream.
 026       *
 027       * After the underlying resource has been detached, the stream object is in
 028       * an unusable state. If you wish to use a Stream object as a PHP stream
 029       * but keep the Stream object in a consistent state, use
 030       * {@see GuzzleHttp\Stream\GuzzleStreamWrapper::getResource}.
 031       *
 032       * @return resource|null Returns the underlying PHP stream resource or null
 033       *                       if the Stream object did not utilize an underlying
 034       *                       stream resource.
 035       */
 036      public function detach();
 037   
 038      /**
 039       * Replaces the underlying stream resource with the provided stream.
 040       *
 041       * Use this method to replace the underlying stream with another; as an
 042       * example, in server-side code, if you decide to return a file, you
 043       * would replace the original content-oriented stream with the file
 044       * stream.
 045       *
 046       * Any internal state such as caching of cursor position should be reset
 047       * when attach() is called, as the stream has changed.
 048       *
 049       * @param resource $stream
 050       *
 051       * @return void
 052       */
 053      public function attach($stream);
 054   
 055      /**
 056       * Get the size of the stream if known
 057       *
 058       * @return int|null Returns the size in bytes if known, or null if unknown
 059       */
 060      public function getSize();
 061   
 062      /**
 063       * Returns the current position of the file read/write pointer
 064       *
 065       * @return int|bool Returns the position of the file pointer or false on error
 066       */
 067      public function tell();
 068   
 069      /**
 070       * Returns true if the stream is at the end of the stream.
 071       *
 072       * @return bool
 073       */
 074      public function eof();
 075   
 076      /**
 077       * Returns whether or not the stream is seekable
 078       *
 079       * @return bool
 080       */
 081      public function isSeekable();
 082   
 083      /**
 084       * Seek to a position in the stream
 085       *
 086       * @param int $offset Stream offset
 087       * @param int $whence Specifies how the cursor position will be calculated
 088       *                    based on the seek offset. Valid values are identical
 089       *                    to the built-in PHP $whence values for `fseek()`.
 090       *                    SEEK_SET: Set position equal to offset bytes
 091       *                    SEEK_CUR: Set position to current location plus offset
 092       *                    SEEK_END: Set position to end-of-stream plus offset
 093       *
 094       * @return bool Returns true on success or false on failure
 095       * @link   http://www.php.net/manual/en/function.fseek.php
 096       */
 097      public function seek($offset, $whence = SEEK_SET);
 098   
 099      /**
 100       * Returns whether or not the stream is writable
 101       *
 102       * @return bool
 103       */
 104      public function isWritable();
 105   
 106      /**
 107       * Write data to the stream
 108       *
 109       * @param string $string The string that is to be written.
 110       *
 111       * @return int|bool Returns the number of bytes written to the stream on
 112       *                  success returns false on failure (e.g., broken pipe,
 113       *                  writer needs to slow down, buffer is full, etc.)
 114       */
 115      public function write($string);
 116   
 117      /**
 118       * Returns whether or not the stream is readable
 119       *
 120       * @return bool
 121       */
 122      public function isReadable();
 123   
 124      /**
 125       * Read data from the stream
 126       *
 127       * @param int $length Read up to $length bytes from the object and return
 128       *                    them. Fewer than $length bytes may be returned if
 129       *                    underlying stream call returns fewer bytes.
 130       *
 131       * @return string     Returns the data read from the stream.
 132       */
 133      public function read($length);
 134   
 135      /**
 136       * Returns the remaining contents of the stream as a string.
 137       *
 138       * Note: this could potentially load a large amount of data into memory.
 139       *
 140       * @return string
 141       */
 142      public function getContents();
 143   
 144      /**
 145       * Get stream metadata as an associative array or retrieve a specific key.
 146       *
 147       * The keys returned are identical to the keys returned from PHP's
 148       * stream_get_meta_data() function.
 149       *
 150       * @param string $key Specific metadata to retrieve.
 151       *
 152       * @return array|mixed|null Returns an associative array if no key is
 153       *                          no key is provided. Returns a specific key
 154       *                          value if a key is provided and the value is
 155       *                          found, or null if the key is not found.
 156       * @see http://php.net/manual/en/function.stream-get-meta-data.php
 157       */
 158      public function getMetadata($key = null);
 159  }
 160