public CharsetMatch[] detectAll() {
        CharsetRecognizer csr;
        int i;
        CharsetMatch charsetMatch;
        int confidence;
        ArrayList<CharsetMatch> matches = new ArrayList<>();
        //  Iterate over all possible charsets, remember all that
        //    give a match quality > 0.
        for (i = 0; i < ALL_CS_RECOGNIZERS.size(); i++) {
            csr = ALL_CS_RECOGNIZERS.get(i).recognizer;
            charsetMatch = csr.match(this);
            if (charsetMatch != null) {
                confidence = charsetMatch.getConfidence() & 0x000000ff;
                if (confidence > 0) {
                    // Just to be safe, constrain
                    confidence = Math.min(confidence, MAX_CONFIDENCE);

                    // Apply charset hint.
                    if ((fDeclaredEncoding != null) &&
                            (fDeclaredEncoding.equalsIgnoreCase(csr.getName()))) {
                        // Reduce lack of confidence (delta between "sure" and current) by 50%.
                        confidence += (MAX_CONFIDENCE - confidence) / 2;
                    }
                    CharsetMatch m = new CharsetMatch(this, csr, confidence, charsetMatch.getName(),
                            charsetMatch.getLanguage());
                    matches.add(m);
                }
            }
        }
        Collections.sort(matches);      // CharsetMatch compares on confidence
        Collections.reverse(matches);   //  Put best match first.
        return matches.toArray(new CharsetMatch[0]);
    }
Return an array of all charsets that appear to be plausible
matches with the input data.  The array is ordered with the
best quality match first.
<p>
Raise an exception if
<ul>
<li>no charsets appear to match the input data.</li>
<li>no input text has been provided</li>
</ul>

@return An array of CharsetMatch objects representing possibly matching charsets.
@stable ICU 3.4
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/txt/CharsetDetector.java