protected function prepareChunk(StreamInterface $stream)
    {
        if (!$this->firstRun && is_null($this->shaved)) {
            // We're starting again after a flush
            $this->shaved = "";

            return true;
        } else if (is_null($this->shaved)) {
            $this->shaved = "";
        }

        $newChunk = $stream->getChunk();

        if ($newChunk !== false) {
            $this->chunk .= $newChunk;

            return true;
        } else {
            if (trim($this->chunk) !== "" && $this->chunk !== $this->lastChunk) {
                // Update anti-freeze protection chunk
                $this->lastChunk = $this->chunk;
                // Continue
                return true;
            }
        }

        return false;
    }