public function read($length)
    {
        $data = '';
        do {
            $moreData = $this->stream->read($length);
            $data .= $moreData;
            $readLength = strlen($moreData);
            $length -= $readLength;
        } while ($length > 0 && $readLength > 0);

        return $data;
    }