Code example for CharsetEncoder

Methods: onMalformedInput, onUnmappableCharacter

0
        } 
    } 
 
    private final void initDefaultEncoder() { 
        mCharset = Charset.defaultCharset().newEncoder();
        mCharset.onMalformedInput(CodingErrorAction.REPLACE);
        mCharset.onUnmappableCharacter(CodingErrorAction.REPLACE);
    } 
 
    private void appendLocked(char c) throws IOException {
        int pos = mPos;
        if (pos >= (mBufferLen-1)) {
            flushLocked(); 
            pos = mPos;
        } 
        mText[pos] = c;
        mPos = pos+1;
    } 
 
    private void appendLocked(String str, int i, final int length) throws IOException {
        final int BUFFER_LEN = mBufferLen;