scratch – Blame information for rev 87
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
87 | office | 1 | <?php |
2 | namespace GuzzleHttp\Stream; |
||
3 | |||
4 | /** |
||
5 | * Describes a stream instance. |
||
6 | */ |
||
7 | interface StreamInterface |
||
8 | { |
||
9 | /** |
||
10 | * Attempts to seek to the beginning of the stream and reads all data into |
||
11 | * a string until the end of the stream is reached. |
||
12 | * |
||
13 | * Warning: This could attempt to load a large amount of data into memory. |
||
14 | * |
||
15 | * @return string |
||
16 | */ |
||
17 | public function __toString(); |
||
18 | |||
19 | /** |
||
20 | * Closes the stream and any underlying resources. |
||
21 | */ |
||
22 | public function close(); |
||
23 | |||
24 | /** |
||
25 | * Separates any underlying resources from the stream. |
||
26 | * |
||
27 | * After the underlying resource has been detached, the stream object is in |
||
28 | * an unusable state. If you wish to use a Stream object as a PHP stream |
||
29 | * but keep the Stream object in a consistent state, use |
||
30 | * {@see GuzzleHttp\Stream\GuzzleStreamWrapper::getResource}. |
||
31 | * |
||
32 | * @return resource|null Returns the underlying PHP stream resource or null |
||
33 | * if the Stream object did not utilize an underlying |
||
34 | * stream resource. |
||
35 | */ |
||
36 | public function detach(); |
||
37 | |||
38 | /** |
||
39 | * Get the size of the stream if known |
||
40 | * |
||
41 | * @return int|null Returns the size in bytes if known, or null if unknown |
||
42 | */ |
||
43 | public function getSize(); |
||
44 | |||
45 | /** |
||
46 | * Returns the current position of the file read/write pointer |
||
47 | * |
||
48 | * @return int|bool Returns the position of the file pointer or false on error |
||
49 | */ |
||
50 | public function tell(); |
||
51 | |||
52 | /** |
||
53 | * Returns true if the stream is at the end of the stream. |
||
54 | * |
||
55 | * @return bool |
||
56 | */ |
||
57 | public function eof(); |
||
58 | |||
59 | /** |
||
60 | * Returns whether or not the stream is seekable |
||
61 | * |
||
62 | * @return bool |
||
63 | */ |
||
64 | public function isSeekable(); |
||
65 | |||
66 | /** |
||
67 | * Seek to a position in the stream |
||
68 | * |
||
69 | * @param int $offset Stream offset |
||
70 | * @param int $whence Specifies how the cursor position will be calculated |
||
71 | * based on the seek offset. Valid values are identical |
||
72 | * to the built-in PHP $whence values for `fseek()`. |
||
73 | * SEEK_SET: Set position equal to offset bytes |
||
74 | * SEEK_CUR: Set position to current location plus offset |
||
75 | * SEEK_END: Set position to end-of-stream plus offset |
||
76 | * |
||
77 | * @return bool Returns true on success or false on failure |
||
78 | * @link http://www.php.net/manual/en/function.fseek.php |
||
79 | */ |
||
80 | public function seek($offset, $whence = SEEK_SET); |
||
81 | |||
82 | /** |
||
83 | * Returns whether or not the stream is writable |
||
84 | * |
||
85 | * @return bool |
||
86 | */ |
||
87 | public function isWritable(); |
||
88 | |||
89 | /** |
||
90 | * Write data to the stream |
||
91 | * |
||
92 | * @param string $string The string that is to be written. |
||
93 | * |
||
94 | * @return int|bool Returns the number of bytes written to the stream on |
||
95 | * success or false on failure. |
||
96 | */ |
||
97 | public function write($string); |
||
98 | |||
99 | /** |
||
100 | * Flush the write buffers of the stream. |
||
101 | * |
||
102 | * @return bool Returns true on success and false on failure |
||
103 | */ |
||
104 | public function flush(); |
||
105 | |||
106 | /** |
||
107 | * Returns whether or not the stream is readable |
||
108 | * |
||
109 | * @return bool |
||
110 | */ |
||
111 | public function isReadable(); |
||
112 | |||
113 | /** |
||
114 | * Read data from the stream |
||
115 | * |
||
116 | * @param int $length Read up to $length bytes from the object and return |
||
117 | * them. Fewer than $length bytes may be returned if |
||
118 | * underlying stream call returns fewer bytes. |
||
119 | * |
||
120 | * @return string Returns the data read from the stream. |
||
121 | */ |
||
122 | public function read($length); |
||
123 | |||
124 | /** |
||
125 | * Returns the remaining contents in a string, up to maxlength bytes. |
||
126 | * |
||
127 | * @param int $maxLength The maximum bytes to read. Defaults to -1 (read |
||
128 | * all the remaining buffer). |
||
129 | * @return string |
||
130 | */ |
||
131 | public function getContents($maxLength = -1); |
||
132 | } |