Here you can find the source of utf8Decoder(CodingErrorAction codingErrorAction, Charset fileCharset)
public static CharsetDecoder utf8Decoder(CodingErrorAction codingErrorAction, Charset fileCharset)
//package com.java2s; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import java.nio.charset.CodingErrorAction; public class Main { public static final Charset utf8Charset = Charset.forName("UTF-8"); public static CharsetDecoder utf8Decoder(CodingErrorAction codingErrorAction, Charset fileCharset) { try {/*ww w . j a v a 2 s . c om*/ if (fileCharset == null) fileCharset = utf8Charset; if (codingErrorAction == null) codingErrorAction = CodingErrorAction.IGNORE; final CharsetDecoder encoder = fileCharset.newDecoder(); encoder.reset(); encoder.onUnmappableCharacter(codingErrorAction); encoder.onMalformedInput(codingErrorAction); return encoder; } catch (Throwable t) { t.printStackTrace(); return null; } } }