@Override public void visitByteRange(ParsingByteRange e) { this.formatString("["); this.formatString(StringUtils.stringfyByte2(e.startByteChar)); this.formatString("-"); this.formatString(StringUtils.stringfyByte2(e.endByteChar)); this.formatString("]"); }
public final int charAt(long pos) { int c = byteAt(pos), c2, c3, c4; int len = StringUtils.lengthOfUtf8(c); switch (len) { case 1: return c; case 2: // 0b11111 = 31 // 0b111111 = 63 c2 = byteAt(pos + 1) & 63; return ((c & 31) << 6) | c2; case 3: c2 = byteAt(pos + 1) & 63; c3 = byteAt(pos + 2) & 63; return ((c & 15) << 12) | c2 << 6 | c3; case 4: c2 = byteAt(pos + 1) & 63; c3 = byteAt(pos + 2) & 63; c4 = byteAt(pos + 3) & 63; return ((c & 7) << 18) | c2 << 12 | c3 << 6 | c4; } return -1; }
@Override public void visitByte(ParsingByte e) { this.formatString(StringUtils.stringfyByte(e.byteChar)); }
@Override public String getInterningKey() { return "[" + StringUtils.stringfyByteMap(this.charMap); }
@Override public String getPredicate() { return "byte " + StringUtils.stringfyByteMap(this.charMap); }
public final int charLength(long pos) { int c = byteAt(pos); return StringUtils.lengthOfUtf8(c); }
private final byte[] toZeroTerminalByteSequence(String s) { byte[] b = StringUtils.toUtf8(s); byte[] b2 = new byte[b.length + 1]; System.arraycopy(b, 0, b2, 0, b.length); return b2; }