Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 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 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Copyright 2012-2017 Horde LLC (http://www.horde.org/) See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Copyright: 2012-2017 Horde LLC
License: http://www.horde.org/licenses/lgpl21 LGPL 2.1
File Size: 624 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Horde_Stream:: (23 methods):
  __construct()
  _init()
  __get()
  __set()
  __clone()
  __toString()
  add()
  length()
  getToChar()
  peek()
  search()
  getString()
  substring()
  getEOL()
  getChar()
  pos()
  rewind()
  seek()
  end()
  eof()
  close()
  serialize()
  unserialize()


Class: Horde_Stream  - X-Ref

Object that adds convenience/utility methods to interacting with PHP
streams.

__construct(array $opts = array()   X-Ref
Constructor.

param: array $opts  Configuration options.

_init()   X-Ref
Initialization method.


__get($name)   X-Ref
No description

__set($name, $value)   X-Ref
No description

__clone()   X-Ref
No description

__toString()   X-Ref
String representation of object.

return: string  The full stream converted to a string.

add($data, $reset = false)   X-Ref
Adds data to the stream.

param: mixed $data     Data to add to the stream. Can be a resource,
param: boolean $reset  Reset stream pointer to initial position after

length($utf8 = false)   X-Ref
Returns the length of the data. Does not change the stream position.

param: boolean $utf8  If true, determines the UTF-8 length of the
return: integer  Stream size.

getToChar($end, $all = true)   X-Ref
Get a string up to a certain character (or EOF).

param: string $end   The character to stop reading at. As of 1.4.0,
param: boolean $all  If true, strips all repetitions of $end from
return: string  The string up to $end (stream is positioned after the

peek($length = 1)   X-Ref
Return the current character(s) without moving the pointer.

param: integer $length  The peek length (since 1.4.0).
return: string  The current character.

search($char, $reverse = false, $reset = true)   X-Ref
Search for character(s) and return its position.

param: string $char      The character to search for. As of 1.4.0,
param: boolean $reverse  Do a reverse search?
param: boolean $reset    Reset the pointer to the original position?
return: mixed  The start position of the search string (integer), or

getString($start = null, $end = null)   X-Ref
Returns the stream (or a portion of it) as a string. Position values
are the byte position in the stream.

param: integer $start  The starting position. If positive, start from
param: integer $end    The ending position relative to the beginning of
return: string  A string.

substring($start = 0, $length = null, $char = false)   X-Ref
Return part of the stream as a string.

param: integer $start   Start, as an offset from the current postion.
param: integer $length  Length of string to return. If null, returns
param: boolean $char    If true, $start/$length is the length in
return: string  The substring.

getEOL()   X-Ref
Auto-determine the EOL string.

return: string  The EOL string, or null if no EOL found.

getChar()   X-Ref
Return a character from the string.

return: string  Character (single byte, or UTF-8 character if

pos()   X-Ref
Return the current stream pointer position.

return: mixed  The current position (integer), or false.

rewind()   X-Ref
Rewind the internal stream to the beginning.

return: boolean  True if successful.

seek($offset = 0, $curr = true, $char = false)   X-Ref
Move internal pointer.

param: integer $offset  The offset.
param: boolean $curr    If true, offset is from current position. If
param: boolean $char    If true, $offset is the length in characters.
return: boolean  True if successful.

end($offset = 0)   X-Ref
Move internal pointer to the end of the stream.

param: integer $offset  Move this offset from the end.
return: boolean  True if successful.

eof()   X-Ref
Has the end of the stream been reached?

return: boolean  True if the end of the stream has been reached.

close()   X-Ref
Close the stream.


serialize()   X-Ref
No description

unserialize($data)   X-Ref
No description