01: /* Licensed to the Apache Software Foundation (ASF) under one or more
02: * contributor license agreements. See the NOTICE file distributed with
03: * this work for additional information regarding copyright ownership.
04: * The ASF licenses this file to You under the Apache License, Version 2.0
05: * (the "License"); you may not use this file except in compliance with
06: * the License. You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package java.nio.charset;
18:
19: /**
20: * Used to indicate what kind of actions to take in case of encoding/decoding
21: * errors. Currently three actions are defined, namely, IGNORE, REPLACE and
22: * REPORT.
23: */
24: public class CodingErrorAction {
25:
26: /**
27: * Indicating the action to ignore any errors.
28: */
29: public static final CodingErrorAction IGNORE = new CodingErrorAction(
30: "IGNORE"); //$NON-NLS-1$
31:
32: /**
33: * Indicating the action to fill in the output with a replacement character
34: * when malformed input or an unmappable character is encountered.
35: */
36: public static final CodingErrorAction REPLACE = new CodingErrorAction(
37: "REPLACE"); //$NON-NLS-1$
38:
39: /**
40: * Indicating the action to report the encountered error in an appropriate
41: * manner, for example, throw an exception or return an informative result.
42: */
43: public static final CodingErrorAction REPORT = new CodingErrorAction(
44: "REPORT"); //$NON-NLS-1$
45:
46: // The name of this action
47: private String action;
48:
49: /*
50: * Can't instantiate outside.
51: */
52: private CodingErrorAction(String action) {
53: this .action = action;
54: }
55:
56: /**
57: * Returns a text description of this action indication..
58: *
59: * @return a text description of this action indication.
60: */
61: public String toString() {
62: return "Action: " + this .action; //$NON-NLS-1$
63: }
64: }
|