Package java.io

Examples of java.io.CharConversionException


                // 1111110x
                _code = b & 0x01;
                _moreBytes = 5;
                return read2();
            } else {
                throw new CharConversionException("Invalid UTF-8 Encoding");
            }
        } else { // No more bytes in buffer.
            if (_inputStream == null)
                throw new IOException("No input stream or stream closed");
            _start = 0;
            _end = _inputStream.read(_bytes, 0, _bytes.length);
            if (_end > 0) {
                return read2(); // Continues.
            } else { // Done.
                if (_moreBytes == 0) {
                    return -1;
                } else { // Incomplete sequence.
                    throw new CharConversionException(
                            "Unexpected end of stream");
                }
            }
        }
    }
View Full Code Here


                        cbuf[i++] = (char) code;
                    } else if (code <= 0x10ffff) { // Surrogates.
                        cbuf[i++] = (char) (((code - 0x10000) >> 10) + 0xd800);
                        cbuf[i++] = (char) (((code - 0x10000) & 0x3ff) + 0xdc00);
                    } else {
                        throw new CharConversionException("Cannot convert U+"
                                + Integer.toHexString(code)
                                + " to char (code greater than U+10FFFF)");
                    }
                    if (_start < _end) {
                        continue;
View Full Code Here

                    dest.append((char) code);
                } else if (code <= 0x10ffff) { // Surrogates.
                    dest.append((char) (((code - 0x10000) >> 10) + 0xd800));
                    dest.append((char) (((code - 0x10000) & 0x3ff) + 0xdc00));
                } else {
                    throw new CharConversionException("Cannot convert U+"
                            + Integer.toHexString(code)
                            + " to char (code greater than U+10FFFF)");
                }
            }
        }
View Full Code Here

                // 1111110x
                _code = b & 0x01;
                _moreBytes = 5;
                return read2(_byteBuffer.get());
            } else {
                throw new CharConversionException("Invalid UTF-8 Encoding");
            }
        } catch (BufferUnderflowException e) {
            throw new CharConversionException("Incomplete Sequence");
        }
    }
View Full Code Here

                            cbuf[i++] = (char) code;
                        } else if (code <= 0x10ffff) { // Surrogates.
                            cbuf[i++] = (char) (((code - 0x10000) >> 10) + 0xd800);
                            cbuf[i++] = (char) (((code - 0x10000) & 0x3ff) + 0xdc00);
                        } else {
                            throw new CharConversionException(
                                    "Cannot convert U+"
                                            + Integer.toHexString(code)
                                            + " to char (code greater than U+10FFFF)");
                        }
                    } else { // Not enough space in destination (go back).
View Full Code Here

                    dest.append((char) code);
                } else if (code <= 0x10ffff) { // Surrogates.
                    dest.append((char) (((code - 0x10000) >> 10) + 0xd800));
                    dest.append((char) (((code - 0x10000) & 0x3ff) + 0xdc00));
                } else {
                    throw new CharConversionException("Cannot convert U+"
                            + Integer.toHexString(code)
                            + " to char (code greater than U+10FFFF)");
                }
            }
        }
View Full Code Here

            _bytes[_index] = (byte) (0x80 | (c & 0x3F));
            if (++_index >= _bytes.length) {
                flushBuffer();
            }
        } else {
            throw new CharConversionException("Illegal character U+"
                    + Integer.toHexString(c));
        }
    }
View Full Code Here

            int mult = 1;
            for (int i = valueL - 1; i > colonPos; i--) {
                int charValue = HexUtils.DEC[(int) valueB[i + valueS]];
                if (charValue == -1) {
                    // Invalid character
                    throw new CharConversionException("Invalid char in port: " + valueB[i + valueS]);
                }
                port = port + (charValue * mult);
                mult = 10 * mult;
            }
            request.setServerPort(port);
View Full Code Here

      if ((c & 0xff00) != 0) {  // high order byte must be zero
    String errMsg = lStrings.getString("err.not_iso8859_1");
    Object[] errArgs = new Object[1];
    errArgs[0] = new Character(c);
    errMsg = MessageFormat.format(errMsg, errArgs);
    throw new CharConversionException(errMsg);
      }
      write (c);
  }
    }
View Full Code Here

      } else if( buff[ j ] != '%' ) {
    buff[idx]= buff[j];
      } else {
    // read next 2 digits
    if( j+2 >= end ) {
        throw new CharConversionException("EOF");
    }
    byte b1= buff[j+1];
    byte b2=buff[j+2];
    if( !isHexDigit( b1 ) || ! isHexDigit(b2 ))
        throw new CharConversionException( "isHexDigit");
   
    j+=2;
    int res=x2c( b1, b2 );
    buff[idx]=(byte)res;
      }
View Full Code Here

TOP

Related Classes of java.io.CharConversionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.