public static int length(Encoding enc, byte[]bytes, int p, int end) { int n = enc.length(bytes, p, end); if (MBCLEN_CHARFOUND_P(n) && MBCLEN_CHARFOUND_LEN(n) <= end - p) return MBCLEN_CHARFOUND_LEN(n); int min = enc.minLength(); return min <= end - p ? min : end - p; }
public static int length(Encoding enc, byte[]bytes, int p, int end) { int n = enc.length(bytes, p, end); if (MBCLEN_CHARFOUND_P(n) && MBCLEN_CHARFOUND_LEN(n) <= end - p) return MBCLEN_CHARFOUND_LEN(n); int min = enc.minLength(); return min <= end - p ? min : end - p; }
public static int encCodepointLength(byte[] pBytes, int p, int e, int[] len_p, Encoding enc) { int r; if (e <= p) throw new IllegalArgumentException("empty string"); r = StringSupport.preciseLength(enc, pBytes, p, e); if (!StringSupport.MBCLEN_CHARFOUND_P(r)) { throw new IllegalArgumentException("invalid byte sequence in " + enc); } if (len_p != null) len_p[0] = StringSupport.MBCLEN_CHARFOUND_LEN(r); return StringSupport.codePoint(enc, pBytes, p, e); }
public static int encCodepointLength(byte[] pBytes, int p, int e, int[] len_p, Encoding enc) { int r; if (e <= p) throw new IllegalArgumentException("empty string"); r = StringSupport.preciseLength(enc, pBytes, p, e); if (!StringSupport.MBCLEN_CHARFOUND_P(r)) { throw new IllegalArgumentException("invalid byte sequence in " + enc); } if (len_p != null) len_p[0] = StringSupport.MBCLEN_CHARFOUND_LEN(r); return StringSupport.codePoint(enc, pBytes, p, e); }
public static int encAscget(byte[] bytes, int offset, int end, int[] chlen, Encoding enc) { int c; int l; if (enc.isAsciiCompatible()) { c = bytes[offset]; if (!Encoding.isAscii((byte)c)) { return -1; } if (chlen != null) chlen[0] = 1; return c; } l = StringSupport.preciseLength(enc, bytes, offset, end); if (StringSupport.MBCLEN_CHARFOUND_LEN(l) == 0) { return -1; } c = enc.mbcToCode(bytes, offset, end); if (!Encoding.isAscii(c)) { return -1; } if (chlen != null) chlen[0] = 1; return c; }
public static int encAscget(byte[] bytes, int offset, int end, int[] chlen, Encoding enc) { int c; int l; if (enc.isAsciiCompatible()) { c = bytes[offset]; if (!Encoding.isAscii((byte)c)) { return -1; } if (chlen != null) chlen[0] = 1; return c; } l = StringSupport.preciseLength(enc, bytes, offset, end); if (StringSupport.MBCLEN_CHARFOUND_LEN(l) == 0) { return -1; } c = enc.mbcToCode(bytes, offset, end); if (!Encoding.isAscii(c)) { return -1; } if (chlen != null) chlen[0] = 1; return c; }
l = preciseLength(enc, bytes, p, p + len); if (MBCLEN_CHARFOUND_P(l)) { l = MBCLEN_CHARFOUND_LEN(l); if (l == len) { return NeighborChar.FOUND;
l = preciseLength(enc, bytes, p, p + len); if (MBCLEN_CHARFOUND_P(l)) { l = MBCLEN_CHARFOUND_LEN(l); if (l == len) { return NeighborChar.FOUND;
l = preciseLength(enc, bytes, p, p + len); if (MBCLEN_CHARFOUND_P(l)) { l = MBCLEN_CHARFOUND_LEN(l); if (l == len) { return NeighborChar.FOUND;
l = preciseLength(enc, bytes, p, p + len); if (MBCLEN_CHARFOUND_P(l)) { l = MBCLEN_CHARFOUND_LEN(l); if (l == len) { return NeighborChar.FOUND;
if (enc.isUTF8() && c > 0x7F) { int n = preciseLength(enc, bytes, p - 1, end) - 1; if (MBCLEN_CHARFOUND_LEN(n) > 0) { int cc = codePoint(runtime, enc, bytes, p - 1, end); if (cc <= 0xFFFF) { len += 10; p += MBCLEN_CHARFOUND_LEN(n) - 1; break; if (enc.isUTF8()) { int n = preciseLength(enc, bytes, p - 1, end) - 1; if (MBCLEN_CHARFOUND_LEN(n) > 0) { int cc = codePoint(runtime, enc, bytes, p - 1, end); outBytes.setRealSize(q);
n = StringSupport.MBCLEN_CHARFOUND_LEN(n); c = enc.mbcToCode(pBytes, p, pend); p += n;
n = StringSupport.MBCLEN_CHARFOUND_LEN(n); c = enc.mbcToCode(pBytes, p, pend); p += n;
} else { cr = StringSupport.CR_VALID; if (StringSupport.MBCLEN_CHARFOUND_LEN(r) == 1 && read.isAsciiCompatible() && Encoding.isAscii(bytes.get(0))) { cr = StringSupport.CR_7BIT;
} else { cr = StringSupport.CR_VALID; if (StringSupport.MBCLEN_CHARFOUND_LEN(r) == 1 && read.isAsciiCompatible() && Encoding.isAscii(bytes.get(0))) { cr = StringSupport.CR_7BIT;
throw runtime.newArgumentError("invalid byte sequence in " + enc); n = StringSupport.MBCLEN_CHARFOUND_LEN(r); if (fptr.encs.enc != null) { c = StringSupport.codePoint(runtime, fptr.encs.enc, fptr.cbuf.ptr, fptr.cbuf.off, fptr.cbuf.off + fptr.cbuf.len); r = StringSupport.preciseLength(enc, fptr.rbuf.ptr, fptr.rbuf.off, fptr.rbuf.off + fptr.rbuf.len); if (StringSupport.MBCLEN_CHARFOUND_P(r) && (n = StringSupport.MBCLEN_CHARFOUND_LEN(r)) <= fptr.rbuf.len) { c = StringSupport.codePoint(runtime, fptr.encs.enc, fptr.rbuf.ptr, fptr.rbuf.off, fptr.rbuf.off + fptr.rbuf.len); fptr.rbuf.off += n;
n = MBCLEN_CHARFOUND_LEN(n); c = enc.mbcToCode(pBytes, p, pend); p += n;
n = MBCLEN_CHARFOUND_LEN(n); c = enc.mbcToCode(pBytes, p, pend); p += n;
n = MBCLEN_CHARFOUND_LEN(n); final int c = enc.mbcToCode(bytes, p, end); int cc = 0;
n = MBCLEN_CHARFOUND_LEN(n); final int c = enc.mbcToCode(bytes, p, end); int cc = 0;