01 /*
02 * Copyright 2001-2002 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package java.nio.charset;
27
28 /**
29 * A typesafe enumeration for coding-error actions.
30 *
31 * <p> Instances of this class are used to specify how malformed-input and
32 * unmappable-character errors are to be handled by charset <a
33 * href="CharsetDecoder.html#cae">decoders</a> and <a
34 * href="CharsetEncoder.html#cae">encoders</a>. </p>
35 *
36 *
37 * @author Mark Reinhold
38 * @author JSR-51 Expert Group
39 * @version 1.13, 07/05/05
40 * @since 1.4
41 */
42
43 public class CodingErrorAction {
44
45 private String name;
46
47 private CodingErrorAction(String name) {
48 this .name = name;
49 }
50
51 /**
52 * Action indicating that a coding error is to be handled by dropping the
53 * erroneous input and resuming the coding operation. </p>
54 */
55 public static final CodingErrorAction IGNORE = new CodingErrorAction(
56 "IGNORE");
57
58 /**
59 * Action indicating that a coding error is to be handled by dropping the
60 * erroneous input, appending the coder's replacement value to the output
61 * buffer, and resuming the coding operation. </p>
62 */
63 public static final CodingErrorAction REPLACE = new CodingErrorAction(
64 "REPLACE");
65
66 /**
67 * Action indicating that a coding error is to be reported, either by
68 * returning a {@link CoderResult} object or by throwing a {@link
69 * CharacterCodingException}, whichever is appropriate for the method
70 * implementing the coding process.
71 */
72 public static final CodingErrorAction REPORT = new CodingErrorAction(
73 "REPORT");
74
75 /**
76 * Returns a string describing this action. </p>
77 *
78 * @return A descriptive string
79 */
80 public String toString() {
81 return name;
82 }
83
84 }
|