Path: blob/master/src/java.base/share/classes/java/nio/charset/CodingErrorAction.java
41159 views
/*1* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.nio.charset;262728/**29* A typesafe enumeration for coding-error actions.30*31* <p> Instances of this class are used to specify how malformed-input and32* unmappable-character errors are to be handled by charset <a33* href="CharsetDecoder.html#cae">decoders</a> and <a34* href="CharsetEncoder.html#cae">encoders</a>. </p>35*36*37* @author Mark Reinhold38* @author JSR-51 Expert Group39* @since 1.440*/4142public class CodingErrorAction {4344private String name;4546private CodingErrorAction(String name) {47this.name = name;48}4950/**51* Action indicating that a coding error is to be handled by dropping the52* erroneous input and resuming the coding operation.53*/54public static final CodingErrorAction IGNORE55= new CodingErrorAction("IGNORE");5657/**58* Action indicating that a coding error is to be handled by dropping the59* erroneous input, appending the coder's replacement value to the output60* buffer, and resuming the coding operation.61*/62public static final CodingErrorAction REPLACE63= new CodingErrorAction("REPLACE");6465/**66* Action indicating that a coding error is to be reported, either by67* returning a {@link CoderResult} object or by throwing a {@link68* CharacterCodingException}, whichever is appropriate for the method69* implementing the coding process.70*/71public static final CodingErrorAction REPORT72= new CodingErrorAction("REPORT");7374/**75* Returns a string describing this action.76*77* @return A descriptive string78*/79public String toString() {80return name;81}8283}848586