Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

(no description)

File Size: 323 lines (10 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, object $file)   X-Ref
Constructs a readable GridFS stream.

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

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

return: array

close()   X-Ref
No description

getFile()   X-Ref
No description

getSize()   X-Ref
No description

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


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

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


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

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

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.