protected function _ensureReadable($bytePerByte = true)
    {
        if (!$this->valid()) {
            throw new RuntimeException('Cannot read from a closed stream.');
        }
        if (!$this->isReadable()) {
            $mode = $this->meta('mode');
            throw new RuntimeException("Cannot read on a non-readable stream (mode is `'{$mode}'`).");
        }
    }