Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 474
نمايش فراداده

CodingErrorActionjava.nio.charset

Java 1.4

This class is a typesafe enumeration that defines three constants that serve as the legal argument values to the onMalformedInput( ) and onUnmappableCharacter( ) methods of CharsetDecoder and CharsetEncoder. These constants specify how malformed input and unmappable error conditions should be handled. The values are:

CodingErrorAction.REPORT

Specifies that the error should be reported. This is done by returning a CoderResult object from the three-argument version of decode( ) or encode( ) or by throwing a MalformedInputException or UnmappableCharacterException from the one-argument version of decode( ) or encode( ). This is the default action for both error types for both CharsetDecoder and CharsetEncoder.

CodingErrorAction.IGNORE

Specifies that the malformed input or unmappable input character should simply be skipped, with no output.

CodingErrorAction.REPLACE

Specifies that the malformed input or unmappable character should be skipped and the replacement string or replacement bytes should be appended to the output.

See CharsetDecoder for more information.

public class

CodingErrorAction { // No Constructor // Public Constants public static final CodingErrorAction

IGNORE ; public static final CodingErrorAction

REPLACE ; public static final CodingErrorAction

REPORT ; // Public Methods Overriding Object public String

toString ( ); }

Passed To

CharsetDecoder.{implOnMalformedInput( ), implOnUnmappableCharacter( ), onMalformedInput( ), onUnmappableCharacter( )}, CharsetEncoder.{implOnMalformedInput( ), implOnUnmappableCharacter( ), onMalformedInput( ), onUnmappableCharacter( )}

Returned By

CharsetDecoder.{malformedInputAction( ), unmappableCharacterAction( )}, CharsetEncoder.{malformedInputAction( ), unmappableCharacterAction( )}