Throws an exception corresponding to this coder result. @throws BufferUnderflowException in case this is an underflow. @throws BufferOverflowException in case this is an overflow. @throws UnmappableCharacterException in case this is an unmappable-character error.
()
| 239 | * the default exception. |
| 240 | */ |
| 241 | public void throwException() throws BufferUnderflowException, |
| 242 | BufferOverflowException, UnmappableCharacterException, |
| 243 | MalformedInputException, CharacterCodingException { |
| 244 | switch (this.type) { |
| 245 | case TYPE_UNDERFLOW: |
| 246 | throw new BufferUnderflowException(); |
| 247 | case TYPE_OVERFLOW: |
| 248 | throw new BufferOverflowException(); |
| 249 | case TYPE_UNMAPPABLE_CHAR: |
| 250 | throw new UnmappableCharacterException(this.length); |
| 251 | case TYPE_MALFORMED_INPUT: |
| 252 | throw new MalformedInputException(this.length); |
| 253 | default: |
| 254 | throw new CharacterCodingException(); |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * Returns a text description of this result. |