Code example for CharsetDecoder

Methods: decode

    private static String decode(ByteBuffer bb, CharsetDecoder decoder)
        CharBuffer cb = CharBuffer.allocate(128);
        CoderResult result = decoder.decode((ByteBuffer) bb.flip(), cb, true /* endOfInput */);
        if (result.isError())
            throw new IllegalArgumentException("Malformed UTF-8!");
        return ((CharBuffer) cb.flip()).toString();
    private static boolean endsWith(CharSequence seq, String part)
        int len = part.length();
        if (seq.length() < len)
            return false; 
Connect your IDE to all the code out there  Get Codota for Java