Package java.io

Examples of java.io.CharConversionException


            } 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 );
        if (noSlash && (res == '/')) {
            throw new CharConversionException( "noSlash");
        }
                buff[idx]=(byte)res;
            }
        }
View Full Code Here


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

        if (offset >= end)
          throw new EOFException("unexpected end of file in utf8 character");
       
        int ch2 = buf[offset++] & 0xff;
        if ((ch2 & 0xc0) != 0x80)
          throw new CharConversionException("illegal utf8 encoding");
     
        _cb.append((char) (((ch1 & 0x1f) << 6) + (ch2 & 0x3f)));
      }
      else if ((ch1 & 0xf0) == 0xe0) {
        if (offset + 1 >= end)
          throw new EOFException("unexpected end of file in utf8 character");
       
        int ch2 = buf[offset++] & 0xff;
        int ch3 = buf[offset++] & 0xff;
     
        if ((ch2 & 0xc0) != 0x80)
          throw new CharConversionException("illegal utf8 encoding");
     
        if ((ch3 & 0xc0) != 0x80)
          throw new CharConversionException("illegal utf8 encoding");
     
        _cb.append((char) (((ch1 & 0x1f) << 12) + ((ch2 & 0x3f) << 6) + (ch3 & 0x3f)));
      }
      else
        throw new CharConversionException("illegal utf8 encoding at (" +
                                          (int) ch1 + ")");
    }
  }
View Full Code Here

    public void testParserThrowsCharConversionException()
      throws SAXException, IOException {
       
        XMLReader parser = XMLReaderFactory.createXMLReader(
          "org.apache.xerces.parsers.SAXParser");
        Exception cause = new CharConversionException();
        XMLFilter filter = new ExceptionTester(cause);
        filter.setParent(parser);
        Builder builder = new Builder(filter);
       
        try {
View Full Code Here

            final char c = sequence.charAt(start);
            if (Character.isLowSurrogate(c)) {
                append(c);
                start++;
            } else {
                throw new CharConversionException();
            }
        }
        return start;
    }
View Full Code Here

            out.append((char) c);
        } else if (Character.isSupplementaryCodePoint(c)) {
            out.append(JDK7.highSurrogate(c))
               .append(JDK7. lowSurrogate(c));
        } else {
            throw new CharConversionException();
        }
    }
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

    buff[idx]=buff[j];
      } else {
    // read next 2 digits
    if( j+2 >= cend ) {
        // invalid
        throw new CharConversionException("EOF");
    }
    char b1= buff[j+1];
    char b2=buff[j+2];
    if( !isHexDigit( b1 ) || ! isHexDigit(b2 ))
        throw new CharConversionException("isHexDigit");
   
    j+=2;
    int res=x2c( b1, b2 );
    buff[idx]=(char)res;
      }
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

            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

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.