private function writeEncoded($bytes)
    {
        $encoded = preg_replace('/\r\n|\r|\n/', "\r\n", rtrim(convert_uuencode($bytes)));
        // removes ending '`' line
        $this->stream->write("\r\n" . rtrim(substr($encoded, 0, -1)));
    }