Code example for CharsetDecoder

Methods: decodeflushreset

0
    public void testDecodeFacadeIllegalState() throws CharacterCodingException {
        // decode facade can be execute in anywhere 
        ByteBuffer in = getByteBuffer();
 
        // Normal case: just created 
        decoder.decode(in);
        in.rewind();
 
        // Normal case: just after decode facade 
        decoder.decode(in);
        in.rewind();
 
        // Normal case: just after decode with that endOfInput is true 
        decoder.reset();
        decoder.decode(getByteBuffer(), CharBuffer.allocate(30), true);
        decoder.decode(in);
        in.rewind();
 
        // Normal case:just after decode with that endOfInput is false 
        decoder.reset();
        decoder.decode(getByteBuffer(), CharBuffer.allocate(30), false);
        decoder.decode(in);
        in.rewind();
 
        // Normal case: just after flush 
        decoder.reset();
        decoder.decode(getByteBuffer(), CharBuffer.allocate(30), true);
        decoder.flush(CharBuffer.allocate(10));
        decoder.decode(in);
        in.rewind();
    } 
 
    // test illegal states for two decode method with endOfInput is true 
    public void testDecodeTrueIllegalState() throws CharacterCodingException {
Contextual code suggestions in your IDE  Get Codota for Java