KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > nio > charset > CodingErrorAction


1 /*
2  * @(#)CodingErrorAction.java 1.6 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.nio.charset;
9
10
11 /**
12  * A typesafe enumeration for coding-error actions.
13  *
14  * <p> Instances of this class are used to specify how malformed-input and
15  * unmappable-character errors are to be handled by charset <a
16  * HREF="CharsetDecoder.html#cae">decoders</a> and <a
17  * HREF="CharsetEncoder.html#cae">encoders</a>. </p>
18  *
19  *
20  * @author Mark Reinhold
21  * @author JSR-51 Expert Group
22  * @version 1.6, 03/12/19
23  * @since 1.4
24  */

25
26 public class CodingErrorAction {
27
28     private String JavaDoc name;
29
30     private CodingErrorAction(String JavaDoc name) {
31     this.name = name;
32     }
33
34     /**
35      * Action indicating that a coding error is to be handled by dropping the
36      * erroneous input and resuming the coding operation. </p>
37      */

38     public static final CodingErrorAction JavaDoc IGNORE
39     = new CodingErrorAction JavaDoc("IGNORE");
40
41     /**
42      * Action indicating that a coding error is to be handled by dropping the
43      * erroneous input, appending the coder's replacement value to the output
44      * buffer, and resuming the coding operation. </p>
45      */

46     public static final CodingErrorAction JavaDoc REPLACE
47     = new CodingErrorAction JavaDoc("REPLACE");
48
49     /**
50      * Action indicating that a coding error is to be reported, either by
51      * returning a {@link CoderResult} object or by throwing a {@link
52      * CharacterCodingException}, whichever is appropriate for the method
53      * implementing the coding process.
54      */

55     public static final CodingErrorAction JavaDoc REPORT
56     = new CodingErrorAction JavaDoc("REPORT");
57
58     /**
59      * Returns a string describing this action. </p>
60      *
61      * @return A descriptive string
62      */

63     public String JavaDoc toString() {
64     return name;
65     }
66
67 }
68
Popular Tags