unmappableCharacterAction()方法是java.nio.charset.CharsetDecoder类的内置方法,该方法针对unmappable-character错误返回此解码器的当前操作。
用法:
public CodingErrorAction unmappableCharacterAction()
参数:该函数不接受任何参数。
返回值:函数会针对unmappable-character错误返回此解码器的当前操作。
下面是上述函数的实现:
示例1:
// Java program to demonstrate
// the above function
import java.nio.charset.*;
import java.util.Iterator;
import java.util.Map;
public class GFG {
public static void main(String[] args)
{
// Gets the charset
Charset charset = Charset.forName("ISO-2022-CN");
// Get the CharsetDecoder
CharsetDecoder decoder = charset.newDecoder();
// Prints the CharsetDecoder
System.out.println("CharsetDecoder: " + decoder);
System.out.println("Current action for "
+ "unmappable-character errors: "
+ decoder.unmappableCharacterAction());
}
}
输出:
CharsetDecoder: sun.nio.cs.ext.ISO2022_CN$Decoder@232204a1 Current action for unmappable-character errors: REPORT
示例2:
// Java program to demonstrate
// the above function
import java.nio.charset.*;
import java.util.Iterator;
import java.util.Map;
public class GFG {
public static void main(String[] args)
{
// Gets the charset
Charset charset = Charset.forName("x-windows-949");
// Get the CharsetDecoder
CharsetDecoder decoder = charset.newDecoder();
// Prints the CharsetDecoder
System.out.println("CharsetDecoder: " + decoder);
System.out.println("Current action for "
+ "unmappable-character errors: "
+ decoder.unmappableCharacterAction());
}
}
输出:
CharsetDecoder: sun.nio.cs.ext.DoubleByte$Decoder@232204a1 Current action for unmappable-character errors: REPORT
相关用法
- Java CharsetEncoder unmappableCharacterAction()用法及代码示例
- Java CharsetDecoder reset()用法及代码示例
- Java CharsetDecoder averageCharsPerByte()用法及代码示例
- Java CharsetDecoder detectedCharset()用法及代码示例
- Java CharsetDecoder malformedInputAction()用法及代码示例
- Java CharsetDecoder isAutoDetecting()用法及代码示例
- Java CharsetDecoder isCharsetDetected()用法及代码示例
- Java CharsetDecoder replacement()用法及代码示例
- Java CharsetDecoder maxCharsPerByte()用法及代码示例
- Java CharsetDecoder charset()用法及代码示例
- Java Java lang.Long.byteValue()用法及代码示例
- Java Java lang.Long.reverse()用法及代码示例
- Java Java.util.Collections.disjoint()用法及代码示例
- Java Java lang.Long.builtcount()用法及代码示例
- Java Java.util.Collections.rotate()用法及代码示例
注:本文由纯净天空筛选整理自ShubhamMaurya3大神的英文原创作品 CharsetDecoder unmappableCharacterAction() method in Java with Examples。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。