ICU-6144 Add new methods to specify callback on malform and unmapple errors.

X-SVN-Rev: 23490
This commit is contained in:
Michael Ow 2008-02-27 17:48:58 +00:00
parent 262b4e1c8d
commit b6df9c649e
2 changed files with 388 additions and 267 deletions

View File

@ -129,6 +129,16 @@ public abstract class CharsetDecoderICU extends CharsetDecoder{
onMalformedInput = getCallback(newAction);
}
/**
* Sets the callback decoder method to be used if an illegal sequence is encountered.
*
* @param newCallback CharsetCallback.Decoder
* @exception IllegalArgumentException
* @draft ICU 4.0
*/
public final void onMalformedInput(CharsetCallback.Decoder newCallback) {
onMalformedInput = newCallback;
}
/**
* Sets the action to be taken if an illegal sequence is encountered
*
@ -150,6 +160,17 @@ public abstract class CharsetDecoderICU extends CharsetDecoder{
onUnmappableCharacter = getCallback(newAction);
}
/**
* Sets the callback decoder method to be used if an illegal sequence is encountered.
*
* @param newCallback CharsetCallback.Decoder
* @exception IllegalArgumentException
* @draft ICU 4.0
*/
public final void onUnmappableCharacter(CharsetCallback.Decoder newCallback) {
onUnmappableCharacter = newCallback;
}
private static CharsetCallback.Decoder getCallback(CodingErrorAction action){
if(action==CodingErrorAction.REPLACE){
return CharsetCallback.TO_U_CALLBACK_SUBSTITUTE;

File diff suppressed because it is too large Load Diff