Package java.io

Examples of java.io.UTFDataFormatException


    private void expectedByte(int position, int count)
        throws UTFDataFormatException {

        String message = fFormatter.formatMessage(fLocale, "ExpectedByte",
                new Object[] {Integer.toString(position), Integer.toString(count)});
        throw new UTFDataFormatException(message);

    } // expectedByte(int,int,int)
View Full Code Here


    private void invalidByte(int position, int count, int c)
        throws UTFDataFormatException {

        String message = fFormatter.formatMessage(fLocale, "InvalidByte",
                new Object [] {Integer.toString(position), Integer.toString(count)});
        throw new UTFDataFormatException(message);

    } // invalidByte(int,int,int,int)
View Full Code Here

        StringBuffer str = new StringBuffer();
        str.append("high surrogate bits in UTF-8 sequence must not exceed 0x10 but found 0x");

        String message = fFormatter.formatMessage(fLocale, "InvalidHighSurrogate",
                new Object[] {Integer.toHexString(uuuuu)});
        throw new UTFDataFormatException(message);

    } // invalidSurrogate(int)
View Full Code Here

      case 12:
      case 13:
        /* 110x xxxx   10xx xxxx*/
        count += 2;
        if (count > utflen) {
          throw new UTFDataFormatException(
              "malformed input: partial character at end");
        }
        char2 = (int) bytearr[count - 1];
        if ((char2 & 0xC0) != 0x80) {
          throw new UTFDataFormatException(
                "malformed input around byte " + count);
        }
        chararr[chararrCount++] = (char) (((c & 0x1F) << 6) |
            (char2 & 0x3F));
        break;
      case 14:
        /* 1110 xxxx  10xx xxxx  10xx xxxx */
        count += 3;
        if (count > utflen) {
          throw new UTFDataFormatException(
              "malformed input: partial character at end");
        }
        char2 = (int) bytearr[count - 2];
        char3 = (int) bytearr[count - 1];
        if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) {
          throw new UTFDataFormatException(
              "malformed input around byte " + (count - 1));
        }
        chararr[chararrCount++] = (char) (((c & 0x0F) << 12) |
            ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0));
        break;
      default:
        /* 10xx xxxx,  1111 xxxx */
        throw new UTFDataFormatException(
            "malformed input around byte " + count);
      }
    }
    // The number of chars produced may be less than utflen
    return new String(chararr, 0, chararrCount);
View Full Code Here

    /** Throws an exception for expected byte. */
    private void expectedByte(int position, int count)
        throws UTFDataFormatException {

        throw new UTFDataFormatException(
                Localizer.getMessage("jsp.error.xml.expectedByte",
             Integer.toString(position),
             Integer.toString(count)));

    } // expectedByte(int,int,int)
View Full Code Here

    /** Throws an exception for invalid byte. */
    private void invalidByte(int position, int count, int c)
        throws UTFDataFormatException {

        throw new UTFDataFormatException(
                Localizer.getMessage("jsp.error.xml.invalidByte",
             Integer.toString(position),
             Integer.toString(count)));
    } // invalidByte(int,int,int,int)
View Full Code Here

    } // invalidByte(int,int,int,int)

    /** Throws an exception for invalid surrogate bits. */
    private void invalidSurrogate(int uuuuu) throws UTFDataFormatException {
       
        throw new UTFDataFormatException(
                Localizer.getMessage("jsp.error.xml.invalidHighSurrogate",
             Integer.toHexString(uuuuu)));
    } // invalidSurrogate(int)
View Full Code Here

    /** Throws an exception for invalid byte. */
    private void invalidByte(int position, int count, int c)
        throws UTFDataFormatException {

        throw new UTFDataFormatException(
                Localizer.getMessage("jsp.error.xml.invalidByte",
             Integer.toString(position),
             Integer.toString(count)));
    } // invalidByte(int,int,int,int)
View Full Code Here

    } // invalidByte(int,int,int,int)

    /** Throws an exception for invalid surrogate bits. */
    private void invalidSurrogate(int uuuuu) throws UTFDataFormatException {
       
        throw new UTFDataFormatException(
                Localizer.getMessage("jsp.error.xml.invalidHighSurrogate",
             Integer.toHexString(uuuuu)));
    } // invalidSurrogate(int)
View Full Code Here

                utflen += 2;
            }
        }

        if (utflen > 65535) {
            throw new UTFDataFormatException("utflen > 65536!");
        }

        byte[] b = new byte[utflen+2];
        b[boff++] = (byte) ((utflen >>> 8) & 0xFF);
        b[boff++] = (byte) ((utflen >>> 0) & 0xFF);
View Full Code Here

TOP

Related Classes of java.io.UTFDataFormatException

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.