case 0: // check for ASCII if (leadByte > 0x7F) throw new MalformedInputException(count); break; case 1: if (leadByte < 0xC2 || leadByte > 0xDF) throw new MalformedInputException(count); state = TRAIL_BYTE_1; break; case 2: if (leadByte < 0xE0 || leadByte > 0xEF) throw new MalformedInputException(count); state = TRAIL_BYTE_1; break; case 3: if (leadByte < 0xF0 || leadByte > 0xF4) throw new MalformedInputException(count); state = TRAIL_BYTE_1; break; throw new MalformedInputException(count); throw new MalformedInputException(count); if (leadByte == 0xF4 && aByte > 0x8F) throw new MalformedInputException(count); if (leadByte == 0xE0 && aByte < 0xA0) throw new MalformedInputException(count); if (leadByte == 0xED && aByte > 0x9F) throw new MalformedInputException(count);
case 0: // check for ASCII if (leadByte > 0x7F) { throw new MalformedInputException(count); throw new MalformedInputException(count); case 2: if (leadByte < 0xE0 || leadByte > 0xEF) { throw new MalformedInputException(count); case 3: if (leadByte < 0xF0 || leadByte > 0xF4) { throw new MalformedInputException(count); throw new MalformedInputException(count); throw new MalformedInputException(count); throw new MalformedInputException(count); throw new MalformedInputException(count); throw new MalformedInputException(count); throw new MalformedInputException(count);
charset = Charset.JISX0201; else throw new MalformedInputException(0); } else if (in1 == '$') { in1 = mIn.read(); charset = Charset.JISX0208; else throw new MalformedInputException(0); } else throw new MalformedInputException(0); in1 = mIn.read(); int in2 = mIn.read(); if (in2 < 0x21 || in2 >= 0x7f) throw new MalformedInputException(0);
uc = Character.toCodePoint(c, d); } else { throw new RuntimeException("encode UTF8 error", new MalformedInputException(1)); throw new RuntimeException("encode UTF8 error", new MalformedInputException(1)); } else { uc = c;
uc = ((c << 10) + d) + (0x010000 - ('\uD800' << 10) - '\uDC00'); // Character.toCodePoint(c, d) } else { throw new JSONException("encodeUTF8 error", new MalformedInputException(1));
private void checkCoderResult(CoderResult result) throws CharacterCodingException { if (malformedInputAction == CodingErrorAction.REPORT && result.isMalformed()) { throw new MalformedInputException(result.length()); } else if (unmappableCharacterAction == CodingErrorAction.REPORT && result.isUnmappable()) { throw new UnmappableCharacterException(result.length()); } }
private void checkCoderResult(CoderResult result) throws CharacterCodingException { if (result.isMalformed() && malformedInputAction == CodingErrorAction.REPORT) { throw new MalformedInputException(result.length()); } else if (result.isUnmappable() && unmappableCharacterAction == CodingErrorAction.REPORT) { throw new UnmappableCharacterException(result.length()); } }
/** * 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. * @throws MalformedInputException * in case this is a malformed-input error. * @throws CharacterCodingException * the default exception. */ public void throwException() throws BufferUnderflowException, BufferOverflowException, UnmappableCharacterException, MalformedInputException, CharacterCodingException { switch (this.type) { case TYPE_UNDERFLOW: throw new BufferUnderflowException(); case TYPE_OVERFLOW: throw new BufferOverflowException(); case TYPE_UNMAPPABLE_CHAR: throw new UnmappableCharacterException(this.length); case TYPE_MALFORMED_INPUT: throw new MalformedInputException(this.length); default: throw new CharacterCodingException(); } }
throw new MalformedInputException(result.length()); } else if (result.isUnmappable()) { throw new UnmappableCharacterException(result.length());
@Override public int read() throws IOException { int b = this.in.read(); if (b != '%') return b; int hex1 = Character.digit(this.in.read(), 16); if (hex1 == -1) throw new MalformedInputException(2); int hex2 = Character.digit(this.in.read(), 16); if (hex2 == -1) throw new MalformedInputException(3); return (hex1 << 4) + hex2; }
@Override public int read() throws IOException { int b = this.in.read(); if (b != '%') return b; int hex1 = Character.digit(this.in.read(), 16); if (hex1 == -1) throw new MalformedInputException(2); int hex2 = Character.digit(this.in.read(), 16); if (hex2 == -1) throw new MalformedInputException(3); return (hex1 << 4) + hex2; }
private void checkCoderResult(CoderResult result) throws CharacterCodingException { if (result.isMalformed() && malformedInputAction == CodingErrorAction.REPORT) { throw new MalformedInputException(result.length()); } else if (result.isUnmappable() && unmappableCharacterAction == CodingErrorAction.REPORT) { throw new UnmappableCharacterException(result.length()); } }
private void checkCoderResult(CoderResult result) throws CharacterCodingException { if (result.isMalformed() && malformedInputAction == CodingErrorAction.REPORT) { throw new MalformedInputException(result.length()); } else if (result.isUnmappable() && unmappableCharacterAction == CodingErrorAction.REPORT) { throw new UnmappableCharacterException(result.length()); } }
private void checkCoderResult(CoderResult result) throws CharacterCodingException { if (result.isMalformed() && malformedInputAction == CodingErrorAction.REPORT) { throw new MalformedInputException(result.length()); } else if (result.isUnmappable() && unmappableCharacterAction == CodingErrorAction.REPORT) { throw new UnmappableCharacterException(result.length()); } }
private void checkCoderResult(CoderResult result) throws CharacterCodingException { if (malformedInputAction == CodingErrorAction.REPORT && result.isMalformed()) { throw new MalformedInputException(result.length()); } else if (unmappableCharacterAction == CodingErrorAction.REPORT && result.isUnmappable()) { throw new UnmappableCharacterException(result.length()); } }
private void checkCoderResult(CoderResult result) throws CharacterCodingException { if (malformedInputAction == CodingErrorAction.REPORT && result.isMalformed()) { throw new MalformedInputException(result.length()); } else if (unmappableCharacterAction == CodingErrorAction.REPORT && result.isUnmappable()) { throw new UnmappableCharacterException(result.length()); } }
private void checkCoderResult(CoderResult result) throws CharacterCodingException { if (malformedInputAction == CodingErrorAction.REPORT && result.isMalformed()) { throw new MalformedInputException(result.length()); } else if (unmappableCharacterAction == CodingErrorAction.REPORT && result.isUnmappable()) { throw new UnmappableCharacterException(result.length()); } }
private void checkCoderResult(CoderResult result) throws CharacterCodingException { if (malformedInputAction == CodingErrorAction.REPORT && result.isMalformed()) { throw new MalformedInputException(result.length()); } else if (unmappableCharacterAction == CodingErrorAction.REPORT && result.isUnmappable()) { throw new UnmappableCharacterException(result.length()); } }
private void checkCoderResult(CoderResult result) throws CharacterCodingException { if (malformedInputAction == CodingErrorAction.REPORT && result.isMalformed()) { throw new MalformedInputException(result.length()); } else if (unmappableCharacterAction == CodingErrorAction.REPORT && result.isUnmappable()) { throw new UnmappableCharacterException(result.length()); } }
private void checkCoderResult(CoderResult result) throws CharacterCodingException { if (result.isMalformed() && malformedInputAction == CodingErrorAction.REPORT) { throw new MalformedInputException(result.length()); } else if (result.isUnmappable() && unmappableCharacterAction == CodingErrorAction.REPORT) { throw new UnmappableCharacterException(result.length()); } }