Code example for CharsetEncoder

Methods: canEncodeonMalformedInputonUnmappableCharacter

0
     * @see 
     * org.apache.commons.compress.archivers.zip.ZipEncoding#canEncode(java.lang.String) 
     */ 
    public boolean canEncode(String name) {
        CharsetEncoder enc = this.charset.newEncoder();
        enc.onMalformedInput(CodingErrorAction.REPORT);
        enc.onUnmappableCharacter(CodingErrorAction.REPORT);
 
        return enc.canEncode(name);
    } 
 
    /** 
     * @see 
     * org.apache.commons.compress.archivers.zip.ZipEncoding#encode(java.lang.String) 
     */ 
    public ByteBuffer encode(String name) {
        CharsetEncoder enc = this.charset.newEncoder();
 
        enc.onMalformedInput(CodingErrorAction.REPORT);
        enc.onUnmappableCharacter(CodingErrorAction.REPORT);