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. package java.nio.charset;
  8. /**
  9. * A typesafe enumeration for coding-error actions.
  10. *
  11. * <p> Instances of this class are used to specify how malformed-input and
  12. * unmappable-character errors are to be handled by charset <a
  13. * href="CharsetDecoder.html#cae">decoders</a> and <a
  14. * href="CharsetEncoder.html#cae">encoders</a>. </p>
  15. *
  16. *
  17. * @author Mark Reinhold
  18. * @author JSR-51 Expert Group
  19. * @version 1.6, 03/12/19
  20. * @since 1.4
  21. */
  22. public class CodingErrorAction {
  23. private String name;
  24. private CodingErrorAction(String name) {
  25. this.name = name;
  26. }
  27. /**
  28. * Action indicating that a coding error is to be handled by dropping the
  29. * erroneous input and resuming the coding operation. </p>
  30. */
  31. public static final CodingErrorAction IGNORE
  32. = new CodingErrorAction("IGNORE");
  33. /**
  34. * Action indicating that a coding error is to be handled by dropping the
  35. * erroneous input, appending the coder's replacement value to the output
  36. * buffer, and resuming the coding operation. </p>
  37. */
  38. public static final CodingErrorAction REPLACE
  39. = new CodingErrorAction("REPLACE");
  40. /**
  41. * Action indicating that a coding error is to be reported, either by
  42. * returning a {@link CoderResult} object or by throwing a {@link
  43. * CharacterCodingException}, whichever is appropriate for the method
  44. * implementing the coding process.
  45. */
  46. public static final CodingErrorAction REPORT
  47. = new CodingErrorAction("REPORT");
  48. /**
  49. * Returns a string describing this action. </p>
  50. *
  51. * @return A descriptive string
  52. */
  53. public String toString() {
  54. return name;
  55. }
  56. }