Skip to content

Commit

Permalink
Allow option to move pointer to start of stream before reading.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Sep 29, 2013
1 parent 56a3eb6 commit 6512729
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions framework/Stream/lib/Horde/Stream.php
Expand Up @@ -124,15 +124,20 @@ public function add($data, $reset = false)
}

/**
* Read $length number of bytes from the stream.
* Read $length number of bytes from the stream, and move pointer.
*
* @param integer $length The number of bytes to read from the stream.
* @param boolean $rewind Should the stream pointer be moved to the
* start of the stream before reading?
*
* @return string The characters read from the stream.
* @since 1.4.0
*/
public function read($length)
public function read($length, $rewind = false)
{
if ($rewind) {
$this->rewind();
}
return fread($this->stream, $length);
}

Expand Down

0 comments on commit 6512729

Please sign in to comment.