Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 401]

(no description)

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

Defines 1 class

ReadableStream:: (12 methods):
  __construct()
  __debugInfo()
  close()
  getFile()
  getSize()
  isEOF()
  readBytes()
  seek()
  tell()
  initBufferFromCurrentChunk()
  initBufferFromNextChunk()
  initChunksIterator()


Class: ReadableStream  - X-Ref

ReadableStream abstracts the process of reading a GridFS file.

__construct(CollectionWrapper $collectionWrapper, stdClass $file)   X-Ref
Constructs a readable GridFS stream.

param: CollectionWrapper $collectionWrapper GridFS collection wrapper
param: stdClass          $file              GridFS file document

__debugInfo()   X-Ref
Return internal properties for debugging purposes.

return: array

close()   X-Ref
No description

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

return: stdClass

getSize()   X-Ref
Return the stream's size in bytes.

return: integer

isEOF()   X-Ref
Return whether the current read position is at the end of the stream.

return: boolean

readBytes($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

seek($offset)   X-Ref
Seeks the chunk and buffer offsets for the next read operation.

param: integer $offset

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

This is the offset within the stream where the next byte would be read.

return: integer

initBufferFromCurrentChunk()   X-Ref
Initialize the buffer to the current chunk's data.

return: boolean Whether there was a current chunk to read

initBufferFromNextChunk()   X-Ref
Advance to the next chunk and initialize the buffer to its data.

return: boolean Whether there was a next chunk to read

initChunksIterator()   X-Ref
Initializes the chunk iterator starting from the current offset.