'Takes a chunk of a document and feeds it through all of the relevant
charset probers.
After calling ``feed``, you can check the value of the ``done``
attribute to see if you need to continue feeding the
``UniversalDetector`` more data, or if it has made a prediction
(in the ``result`` attribute).
.. note::
You should always call ``close`` when you\'re done feeding in your
document if ``done`` is not already ``True``.'

def feed(self, byte_str):

    if self.done:
        return
    if (not len(byte_str)):
        return
    if (not isinstance(byte_str, bytearray)):
        byte_str = bytearray(byte_str)
    if (not self._got_data):
        if byte_str.startswith(codecs.BOM_UTF8):
            self.result = {'encoding': 'UTF-8-SIG', 'confidence': 1.0, 'language': ''}
        elif byte_str.startswith((codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE)):
            self.result = {'encoding': 'UTF-32', 'confidence': 1.0, 'language': ''}
        elif byte_str.startswith('\xfe\xff\x00\x00'):
            self.result = {'encoding': 'X-ISO-10646-UCS-4-3412', 'confidence': 1.0, 'language': ''}
        elif byte_str.startswith('\x00\x00\xff\xfe'):
            self.result = {'encoding': 'X-ISO-10646-UCS-4-2143', 'confidence': 1.0, 'language': ''}
        elif byte_str.startswith((codecs.BOM_LE, codecs.BOM_BE)):
            self.result = {'encoding': 'UTF-16', 'confidence': 1.0, 'language': ''}
        self._got_data = True
        if (self.result['encoding'] is not None):
            self.done = True
            return
    if (self._input_state == InputState.PURE_ASCII):
        if self.HIGH_BYTE_DETECTOR.search(byte_str):
            self._input_state = InputState.HIGH_BYTE
        elif ((self._input_state == InputState.PURE_ASCII) and self.ESC_DETECTOR.search((self._last_char + byte_str))):
            self._input_state = InputState.ESC_ASCII
    self._last_char = byte_str[(-1):]
    if (self._input_state == InputState.ESC_ASCII):
        if (not self._esc_charset_prober):
            self._esc_charset_prober = EscCharSetProber(self.lang_filter)
        if (self._esc_charset_prober.feed(byte_str) == ProbingState.FOUND_IT):
            self.result = {'encoding': self._esc_charset_prober.charset_name, 'confidence': self._esc_charset_prober.get_confidence(), 'language': self._esc_charset_prober.language}
            self.done = True
    elif (self._input_state == InputState.HIGH_BYTE):
        if (not self._charset_probers):
            self._charset_probers = [MBCSGroupProber(self.lang_filter)]
            if (self.lang_filter & LanguageFilter.NON_CJK):
                self._charset_probers.append(SBCSGroupProber())
            self._charset_probers.append(Latin1Prober())
        for prober in self._charset_probers:
            if (prober.feed(byte_str) == ProbingState.FOUND_IT):
                self.result = {'encoding': prober.charset_name, 'confidence': prober.get_confidence(), 'language': prober.language}
                self.done = True
                break
        if self.WIN_BYTE_DETECTOR.search(byte_str):
            self._has_win_bytes = True
