Swift_ByteStream_ArrayByteStream::read PHP Méthode

read() public méthode

If less bytes exist than are requested the remaining bytes are given instead. If no bytes are remaining at all, boolean false is returned.
public read ( integer $length ) : string
$length integer
Résultat string
    public function read($length)
    {
        if ($this->_offset == $this->_arraySize) {
            return false;
        }
        // Don't use array slice
        $end = $length + $this->_offset;
        $end = $this->_arraySize < $end ? $this->_arraySize : $end;
        $ret = '';
        for (; $this->_offset < $end; ++$this->_offset) {
            $ret .= $this->_array[$this->_offset];
        }
        return $ret;
    }