Name
CodingErrorAction
Synopsis
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 ofdecode( )
orencode( )
or by throwing aMalformedInputException
orUnmappableCharacterException
from the one-argument version ofdecode( )
orencode( )
. This is the default action for both error types for bothCharsetDecoder
andCharsetEncoder
.-
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( ...
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.