Code example for CharsetDecoder

Methods: onMalformedInputonUnmappableCharacter

0
            encoding = Charset.defaultCharset().name();
        } else if (!Charset.isSupported(encoding)) {
            throw new IllegalArgumentException(encoding + " is not supported");
        } 
        decoder = Charset.forName(encoding).newDecoder();
        decoder.onMalformedInput(CodingErrorAction.REPLACE);
        decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
    } 
 
    /** 
     * Closes this output stream and releases any system resources 
     * associated with this stream. The general contract of <code>close</code> 
     * is that it closes the output stream. A closed stream cannot perform 
     * output operations and cannot be reopened. 
     * <p> 
     * 
     * @exception  IOException  if an I/O error occurs. 
     */ 
    @Override 
    public void close() throws IOException {