3 namespace Drupal\Core\StreamWrapper;
6 * Defines a generic PHP stream wrapper interface.
8 * @see http://php.net/manual/class.streamwrapper.php
10 interface PhpStreamWrapperInterface {
15 public function dir_closedir();
20 public function dir_opendir($path, $options);
25 public function dir_readdir();
30 public function dir_rewinddir();
35 public function mkdir($path, $mode, $options);
40 public function rename($path_from, $path_to);
45 public function rmdir($path, $options);
48 * Retrieve the underlying stream resource.
50 * This method is called in response to stream_select().
53 * Can be STREAM_CAST_FOR_SELECT when stream_select() is calling
54 * stream_cast() or STREAM_CAST_AS_STREAM when stream_cast() is called for
57 * @return resource|false
58 * The underlying stream resource or FALSE if stream_select() is not
61 * @see stream_select()
62 * @see http://php.net/manual/streamwrapper.stream-cast.php
64 public function stream_cast($cast_as);
69 public function stream_close();
74 public function stream_eof();
79 public function stream_flush();
84 public function stream_lock($operation);
87 * Sets metadata on the stream.
90 * A string containing the URI to the file to set metadata on.
93 * - STREAM_META_TOUCH: The method was called in response to touch().
94 * - STREAM_META_OWNER_NAME: The method was called in response to chown()
95 * with string parameter.
96 * - STREAM_META_OWNER: The method was called in response to chown().
97 * - STREAM_META_GROUP_NAME: The method was called in response to chgrp().
98 * - STREAM_META_GROUP: The method was called in response to chgrp().
99 * - STREAM_META_ACCESS: The method was called in response to chmod().
100 * @param mixed $value
102 * - STREAM_META_TOUCH: Array consisting of two arguments of the touch()
104 * - STREAM_META_OWNER_NAME or STREAM_META_GROUP_NAME: The name of the owner
105 * user/group as string.
106 * - STREAM_META_OWNER or STREAM_META_GROUP: The value of the owner
107 * user/group as integer.
108 * - STREAM_META_ACCESS: The argument of the chmod() as integer.
111 * Returns TRUE on success or FALSE on failure. If $option is not
112 * implemented, FALSE should be returned.
114 * @see http://php.net/manual/streamwrapper.stream-metadata.php
116 public function stream_metadata($path, $option, $value);
121 public function stream_open($path, $mode, $options, &$opened_path);
126 public function stream_read($count);
129 * Seeks to specific location in a stream.
131 * This method is called in response to fseek().
133 * The read/write position of the stream should be updated according to the
137 * The byte offset to seek to.
140 * - SEEK_SET: Set position equal to offset bytes.
141 * - SEEK_CUR: Set position to current location plus offset.
142 * - SEEK_END: Set position to end-of-file plus offset.
143 * Defaults to SEEK_SET.
146 * TRUE if the position was updated, FALSE otherwise.
148 * @see http://php.net/manual/streamwrapper.stream-seek.php
150 public function stream_seek($offset, $whence = SEEK_SET);
153 * Change stream options.
155 * This method is called to set options on the stream.
159 * - STREAM_OPTION_BLOCKING: The method was called in response to
160 * stream_set_blocking().
161 * - STREAM_OPTION_READ_TIMEOUT: The method was called in response to
162 * stream_set_timeout().
163 * - STREAM_OPTION_WRITE_BUFFER: The method was called in response to
164 * stream_set_write_buffer().
167 * - STREAM_OPTION_BLOCKING: The requested blocking mode:
168 * - 1 means blocking.
169 * - 0 means not blocking.
170 * - STREAM_OPTION_READ_TIMEOUT: The timeout in seconds.
171 * - STREAM_OPTION_WRITE_BUFFER: The buffer mode, STREAM_BUFFER_NONE or
172 * STREAM_BUFFER_FULL.
175 * - STREAM_OPTION_BLOCKING: This option is not set.
176 * - STREAM_OPTION_READ_TIMEOUT: The timeout in microseconds.
177 * - STREAM_OPTION_WRITE_BUFFER: The requested buffer size.
180 * TRUE on success, FALSE otherwise. If $option is not implemented, FALSE
181 * should be returned.
183 public function stream_set_option($option, $arg1, $arg2);
188 public function stream_stat();
193 public function stream_tell();
198 * Will respond to truncation; e.g., through ftruncate().
200 * @param int $new_size
204 * TRUE on success, FALSE otherwise.
206 public function stream_truncate($new_size);
211 public function stream_write($data);
216 public function unlink($path);
221 public function url_stat($path, $flags);