Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401]

(no description)

File Size: 331 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

StreamWrapper:: (14 methods):
  getFile()
  register()
  stream_close()
  stream_eof()
  stream_open()
  stream_read()
  stream_seek()
  stream_stat()
  stream_tell()
  stream_write()
  getStatTemplate()
  initProtocol()
  initReadableStream()
  initWritableStream()


Class: StreamWrapper  - X-Ref

Stream wrapper for reading and writing a GridFS file.

getFile()   X-Ref
Return the stream's file document.

return: stdClass

register($protocol = 'gridfs')   X-Ref
Register the GridFS stream wrapper.

param: string $protocol Protocol to use for stream_wrapper_register()

stream_close()   X-Ref
Closes the stream.


stream_eof()   X-Ref
Returns whether the file pointer is at the end of the stream.

return: boolean

stream_open($path, $mode, $options, &$openedPath)   X-Ref
Opens the stream.

param: string  $path       Path to the file resource
param: string  $mode       Mode used to open the file (only "r" and "w" are supported)
param: integer $options    Additional flags set by the streams API
param: string  $openedPath Not used
return: boolean

stream_read($length)   X-Ref
Read bytes from the stream.

Note: this method may return a string smaller than the requested length
if data is not available to be read.

param: integer $length Number of bytes to read
return: string

stream_seek($offset, $whence = SEEK_SET)   X-Ref
Return the current position of the stream.

param: integer $offset Stream offset to seek to
param: integer $whence One of SEEK_SET, SEEK_CUR, or SEEK_END
return: boolean True if the position was updated and false otherwise

stream_stat()   X-Ref
Return information about the stream.

return: array

stream_tell()   X-Ref
Return the current position of the stream.

return: integer The current position of the stream

stream_write($data)   X-Ref
Write bytes to the stream.

param: string $data Data to write
return: integer The number of bytes written

getStatTemplate()   X-Ref
Returns a stat template with default values.

return: array

initProtocol($path)   X-Ref
Initialize the protocol from the given path.

param: string $path

initReadableStream()   X-Ref
Initialize the internal stream for reading.

return: boolean

initWritableStream()   X-Ref
Initialize the internal stream for writing.

return: boolean