public static int hexLength(byte[]bytes, int p, int len, Encoding enc) { int hlen = 0; while (len-- > 0 && enc.isXDigit(bytes[p++] & 0xff)) hlen++; return hlen; }
public static int hexLength(byte[]bytes, int p, int len, Encoding enc) { int hlen = 0; while (len-- > 0 && enc.isXDigit(bytes[p++] & 0xff)) hlen++; return hlen; }
public static int hexLength(byte[]bytes, int p, int len, Encoding enc) { int hlen = 0; while (len-- > 0 && enc.isXDigit(bytes[p++] & 0xff)) hlen++; return hlen; }
public static int hexLength(byte[]bytes, int p, int len, Encoding enc) { int hlen = 0; while (len-- > 0 && enc.isXDigit(bytes[p++] & 0xff)) hlen++; return hlen; }
public static int scanHex(byte[]bytes, int p, int len, Encoding enc) { int v = 0; int c; while (len-- > 0 && enc.isXDigit(c = bytes[p++] & 0xff)) { v = (v << 4) + enc.xdigitVal(c); } return v; }
public static int scanHex(byte[]bytes, int p, int len, Encoding enc) { int v = 0; int c; while (len-- > 0 && enc.isXDigit(c = bytes[p++] & 0xff)) { v = (v << 4) + enc.xdigitVal(c); } return v; }
public static int scanHex(byte[]bytes, int p, int len, Encoding enc) { int v = 0; int c; while (len-- > 0 && enc.isXDigit(c = bytes[p++] & 0xff)) { v = (v << 4) + enc.xdigitVal(c); } return v; }
public static int scanHex(byte[]bytes, int p, int len, Encoding enc) { int v = 0; int c; while (len-- > 0 && enc.isXDigit(c = bytes[p++] & 0xff)) { v = (v << 4) + enc.xdigitVal(c); } return v; }
protected final int scanUnsignedHexadecimalNumber(int minLength, int maxLength) { int last = c; int num = 0; int restLen = maxLength - minLength; while(left() && maxLength-- != 0) { fetch(); if (enc.isXDigit(c)) { int val = enc.xdigitVal(c); if ((Integer.MAX_VALUE - val) / 16 < num) return -1; num = (num << 4) + val; } else { unfetch(); maxLength++; break; } } if (maxLength > restLen) return -2; c = last; return num; }
protected final int scanUnsignedHexadecimalNumber(int minLength, int maxLength) { int last = c; int num = 0; int restLen = maxLength - minLength; while(left() && maxLength-- != 0) { fetch(); if (enc.isXDigit(c)) { int val = enc.xdigitVal(c); if ((Integer.MAX_VALUE - val) / 16 < num) return -1; num = (num << 4) + val; } else { unfetch(); maxLength++; break; } } if (maxLength > restLen) return -2; c = last; return num; }
if (left()) { int c2 = peek(); if (enc.isXDigit(c2)) newValueException(ERR_TOO_LONG_WIDE_CHAR_VALUE);
private void fetchTokenFor_xBrace() { if (!left()) return; int last = p; if (peekIs('{') && syntax.opEscXBraceHex8()) { inc(); int num = scanUnsignedHexadecimalNumber(0, 8); if (num < 0) newValueException(ERR_TOO_BIG_WIDE_CHAR_VALUE); if (left()) { if (enc.isXDigit(peek())) newValueException(ERR_TOO_LONG_WIDE_CHAR_VALUE); } if (p > last + enc.length(bytes, last, stop) && left() && peekIs('}')) { inc(); token.type = TokenType.CODE_POINT; token.setCode(num); } else { /* can't read nothing or invalid format */ p = last; } } else if (syntax.opEscXHex2()) { int num = scanUnsignedHexadecimalNumber(0, 2); if (num < 0) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.RAW_BYTE; token.base = 16; token.setC(num); } }
private void fetchTokenFor_xBrace() { if (!left()) return; int last = p; if (peekIs('{') && syntax.opEscXBraceHex8()) { inc(); int num = scanUnsignedHexadecimalNumber(0, 8); if (num < 0) newValueException(ERR_TOO_BIG_WIDE_CHAR_VALUE); if (left()) { if (enc.isXDigit(peek())) newValueException(ERR_TOO_LONG_WIDE_CHAR_VALUE); } if (p > last + enc.length(bytes, last, stop) && left() && peekIs('}')) { inc(); token.type = TokenType.CODE_POINT; token.setCode(num); } else { /* can't read nothing or invalid format */ p = last; } } else if (syntax.opEscXHex2()) { int num = scanUnsignedHexadecimalNumber(0, 2); if (num < 0) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.RAW_BYTE; token.base = 16; token.setC(num); } }
if (left()) { int c2 = peek(); if (enc.isXDigit(c2)) newValueException(ERR_TOO_LONG_WIDE_CHAR_VALUE);