public function read($len = null)
    {
        if (!$this->getInitialized()) {
            $this->_initialize();
            $this->setInitialized(true);
        }

        $ch = -1;

        if ($this->queuedData !== null && $this->queuedData === '') {
            $this->queuedData = null;
        }

        if ($this->queuedData !== null) {
            $ch = $this->queuedData[0];
            $this->queuedData = substr($this->queuedData, 1);
            if ($this->queuedData === '') {
                $this->queuedData = null;
            }
        } else {
            $this->queuedData = $this->readLine();
            if ($this->queuedData === null) {
                $ch = -1;
            } else {
                if ($this->suffix !== null) {
                    $lf = '';
                    if (StringHelper::endsWith($this->queuedData, "\r\n")) {
                        $lf = "\r\n";
                    } elseif (StringHelper::endsWith($this->queuedData, "\n")) {
                        $lf = "\n";
                    }
                    $this->queuedData = substr($this->queuedData, 0, strlen($this->queuedData) - strlen($lf)) . $this->suffix . $lf;
                }
                return $this->read();
            }
        }
        return $ch;
    }