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); }
if (!MBCLEN_CHARFOUND_P(r)) { return NeighborChar.NOT_CHAR; EncodingUtils.encMbcput(c, bytes, p, enc); r = preciseLength(enc, bytes, p, p + len); if (!MBCLEN_CHARFOUND_P(r)) { return NeighborChar.NOT_CHAR; bytes[p + i] = (byte)((bytes[p + i] & 0xff) - 1); l = preciseLength(enc, bytes, p, p + len); if (MBCLEN_CHARFOUND_P(l)) { l = MBCLEN_CHARFOUND_LEN(l); if (l == len) { if (!MBCLEN_CHARFOUND_P(l) && i < len-1) { int len2; int l2;
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; }
if (!MBCLEN_CHARFOUND_P(r)) { return NeighborChar.NOT_CHAR; EncodingUtils.encMbcput(c, bytes, p, enc); r = preciseLength(enc, bytes, p, p + len); if (!MBCLEN_CHARFOUND_P(r)) { return NeighborChar.NOT_CHAR; bytes[p + i] = (byte)((bytes[p + i] & 0xff) - 1); l = preciseLength(enc, bytes, p, p + len); if (MBCLEN_CHARFOUND_P(l)) { l = MBCLEN_CHARFOUND_LEN(l); if (l == len) { if (!MBCLEN_CHARFOUND_P(l) && i < len-1) { int len2; int l2;
if (!MBCLEN_CHARFOUND_P(r)) { return NeighborChar.NOT_CHAR; EncodingUtils.encMbcput(c, bytes, p, enc); r = preciseLength(enc, bytes, p, p + len); if (!MBCLEN_CHARFOUND_P(r)) { return NeighborChar.NOT_CHAR; bytes[p + i] = (byte)((bytes[p + i] & 0xff) + 1); l = preciseLength(enc, bytes, p, p + len); if (MBCLEN_CHARFOUND_P(l)) { l = MBCLEN_CHARFOUND_LEN(l); if (l == len) {
if (!MBCLEN_CHARFOUND_P(r)) { return NeighborChar.NOT_CHAR; EncodingUtils.encMbcput(c, bytes, p, enc); r = preciseLength(enc, bytes, p, p + len); if (!MBCLEN_CHARFOUND_P(r)) { return NeighborChar.NOT_CHAR; bytes[p + i] = (byte)((bytes[p + i] & 0xff) + 1); l = preciseLength(enc, bytes, p, p + len); if (MBCLEN_CHARFOUND_P(l)) { l = MBCLEN_CHARFOUND_LEN(l); if (l == len) {
public static int encAscget(byte[] pBytes, int p, int e, int[] len, Encoding enc) { int c; int l; if (e <= p) { return -1; } if (encAsciicompat(enc)) { c = pBytes[p] & 0xFF; if (!Encoding.isAscii((byte)c)) { return -1; } if (len != null) len[0] = 1; return c; } l = StringSupport.preciseLength(enc, pBytes, p, e); if (!StringSupport.MBCLEN_CHARFOUND_P(l)) { return -1; } c = enc.mbcToCode(pBytes, p, e); if (!Encoding.isAscii(c)) { return -1; } if (len != null) len[0] = l; return c; }
public static int encAscget(byte[] pBytes, int p, int e, int[] len, Encoding enc) { int c; int l; if (e <= p) { return -1; } if (encAsciicompat(enc)) { c = pBytes[p] & 0xFF; if (!Encoding.isAscii((byte)c)) { return -1; } if (len != null) len[0] = 1; return c; } l = StringSupport.preciseLength(enc, pBytes, p, e); if (!StringSupport.MBCLEN_CHARFOUND_P(l)) { return -1; } c = enc.mbcToCode(pBytes, p, e); if (!Encoding.isAscii(c)) { return -1; } if (len != null) len[0] = l; return c; }
long c, cc; int n = StringSupport.preciseLength(enc, pBytes, p, pend); if (!StringSupport.MBCLEN_CHARFOUND_P(n)) { if (p > prev) result.cat(pBytes, prev, p - prev); n = enc.minLength();
long c, cc; int n = StringSupport.preciseLength(enc, pBytes, p, pend); if (!StringSupport.MBCLEN_CHARFOUND_P(n)) { if (p > prev) result.cat(pBytes, prev, p - prev); n = enc.minLength();
if (!MBCLEN_CHARFOUND_P(n)) { if (p > prev) result.cat(bytes, prev, p - prev); n = enc.minLength(); (c == '#' && p < end && MBCLEN_CHARFOUND_P(StringSupport.preciseLength(enc, bytes, p, end)) && ((cc = codePoint(runtime, enc, bytes, p, end)) == '$' || cc == '@' || cc == '{')
if (!StringSupport.MBCLEN_CHARFOUND_P(r)) { enc = fptr.encs.enc; throw runtime.newArgumentError("invalid byte sequence in " + enc); while (fptr.fillbuf(context) >= 0) { 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); if (!StringSupport.MBCLEN_CHARFOUND_P(r)) throw runtime.newArgumentError("invalid byte sequence in " + enc); c = enc.mbcToCode(cbuf, 0, p); block.yield(context, runtime.newFixnum(c));
if (!StringSupport.MBCLEN_CHARFOUND_P(r)) { enc = fptr.encs.enc; throw runtime.newArgumentError("invalid byte sequence in " + enc); while (fptr.fillbuf(context) >= 0) { 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); if (!StringSupport.MBCLEN_CHARFOUND_P(r)) throw runtime.newArgumentError("invalid byte sequence in " + enc); c = enc.mbcToCode(cbuf, 0, p); block.yield(context, runtime.newFixnum(c));
if (!MBCLEN_CHARFOUND_P(n)) { if (p > prev) result.cat(bytes, prev, p - prev); n = enc.minLength(); (c == '#' && p < end && MBCLEN_CHARFOUND_P(StringSupport.preciseLength(enc, bytes, p, end)) && ((cc = codePoint(runtime, enc, bytes, p, end)) == '$' || cc == '@' || cc == '{')
if (!MBCLEN_CHARFOUND_P(n)) { if (p > prev) result.cat(bytes, prev, p - prev); n = enc.minLength(); (c == '#' && p < end && MBCLEN_CHARFOUND_P(StringSupport.preciseLength(enc, bytes, p, end)) && ((cc = codePoint(runtime, enc, bytes, p, end)) == '$' || cc == '@' || cc == '{')
int c, cc; int n = enc.length(pBytes, p, pend); if (!MBCLEN_CHARFOUND_P(n)) { if (p > prev) result.cat(pBytes, prev, p - prev); n = enc.minLength();
if (StringSupport.MBCLEN_CHARFOUND_P(r) && (n = StringSupport.MBCLEN_CHARFOUND_LEN(r)) <= rbuf.len) { str = RubyString.newString(runtime, rbuf.ptr, rbuf.off, n); continue getc_needmore; else if (StringSupport.MBCLEN_CHARFOUND_P(r)) { cr = StringSupport.CR_VALID;
int c, cc; int n = enc.length(pBytes, p, pend); if (!MBCLEN_CHARFOUND_P(n)) { if (p > prev) result.cat(pBytes, prev, p - prev); n = enc.minLength();