30 if($result = preg_match(
'/^(\\w+):\\/\\/((\\w+\\/)+)([\\w\\-\\.]+)(?:\\?(.*))?$/',$path,$matches)){
32 if(array_key_exists($key = $matches[1],$GLOBALS)) $this->_fred = $GLOBALS[$key];
33 else foreach($GLOBALS as $value)
if($value instanceof \
Rsi\
Fred) $this->_fred = $value;
35 $result = $this->_fred->stream->handlersExist($this->_handlers = explode(
'/',substr($matches[2],0,-1)));
36 $this->_filename = $matches[4];
37 parse_str(count($matches) < 6 ? null : $matches[5],$this->_params);
48 if(!$this->
splitPath(\
Rsi\File::addDirSeparator($path) .
'.'))
return false;
49 $this->_dir = $this->_fred->stream->search($this->_handlers);
54 $name = current($this->_dir);
64 public function mkdir($path,$mode,$options){
68 public function rename($path_from,$path_to){
69 if($this->
splitPath($path_from) && ($this->data !==
false) && $this->
splitPath($path_to)){
70 $this->_modified =
true;
72 return $this->
unlink($path_from);
77 public function rmdir($path,$options){
78 return $this->
splitPath(\
Rsi\File::addDirSeparator($path) .
'.') && !$this->_fred->stream->search($this->_handlers);
87 return $this->_position >= strlen($this->data);
91 if($this->_modified) $this->_fred->stream->save($this->_handlers,$this->_filename,$this->_params,$this->_data);
98 case STREAM_META_TOUCH:
99 if(!$this->_data) $this->_data =
'';
108 $this->_position = 0;
109 if(!$this->
splitPath($path))
return false;
111 $this->_readOnly = $this->_modified = $exclusive =
false;
112 switch(substr($mode,0,1)){
114 if(substr($mode,-1) !=
'+') $this->_readOnly =
true;
119 if($this->data !==
false){
120 if($exclusive)
return false;
121 $this->_position = strlen($this->_data);
127 $this->_modified =
true;
134 $data = substr($this->data,$this->_position,$count);
135 $this->_position += strlen($data);
142 if(($offset < 0) || ($offset >= strlen($this->data)))
return false;
143 $this->_position = $offset;
146 if($offset < 0)
return false;
147 $this->_position += $offset;
150 if(($length = strlen($this->data)) + $offset < 0)
return false;
151 $this->_position = $length + $offset;
167 'mode' => 0777 | 0100000,
172 'size' => strlen($this->data),
186 $this->_data = substr($this->data,0,$new_size);
190 if($this->_readOnly)
return false;
191 if($length = strlen($data)){
192 $this->_data = substr($this->data,0,$this->_position) . $data . substr($this->data,$this->_position += $length);
193 $this->_modified =
true;
199 return $this->
splitPath($path) ? $this->_fred->stream->delete($this->_handlers,$this->_filename,$this->_params) :
false;
203 return $this->
splitPath($path) && $this->_fred->stream->exists($this->_handlers,$this->_filename,$this->_params)
212 'size' => strlen($this->data),
214 'mtime' => $this->_fred->stream->time($this->_handlers,$this->_filename,$this->_params),
223 if($this->_data === null) $this->_data = $this->_fred->stream->read($this->_handlers,$this->_filename,$this->_params);
splitPath($path)
Split the path in protocol, handlers, filename and optional parameters (all stored in properties)...
stream_set_option($option, $arg1, $arg2)
mkdir($path, $mode, $options)
stream_open($path, $mode, $options, &$opened_path)
rename($path_from, $path_to)
Framework for Rapid and Easy Development.
stream_metadata($path, $option, $value)
stream_seek($offset, $whence)
stream_truncate($new_size)
dir_opendir($path, $options)