@Override
    public Detection detect(ByteBuffer input, Hint hint) {
        if (input.hasArray())
            return detect(input.array(), input.arrayOffset() + input.position(), input.remaining(), hint);

        byte[] buffer = new byte[input.remaining()];
        input.get(buffer);
        return detect(buffer, 0, buffer.length, hint);
    }
Detects text language using patched OpenNLP, with fallback to {@link SimpleDetector} for undetected CJK input.

@author jonmv
opennlp-linguistics/src/main/java/com/yahoo/language/opennlp/OpenNlpDetector.java