private static int codeRangeScanNonAsciiCompatible(Encoding enc, byte[]bytes, int p, int len) { int end = p + len; while (p < end) { int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) return CR_BROKEN; p += cl; } return p > end ? CR_BROKEN : CR_VALID; }
private static int codeRangeScanNonAsciiCompatible(Encoding enc, byte[]bytes, int p, int len) { int end = p + len; while (p < end) { int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) return CR_BROKEN; p += cl; } return p > end ? CR_BROKEN : CR_VALID; }
private static int codeRangeScanNonAsciiCompatible(Encoding enc, byte[]bytes, int p, int len) { int end = p + len; while (p < end) { int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) return CR_BROKEN; p += cl; } return p > end ? CR_BROKEN : CR_VALID; }
private static int codeRangeScanNonAsciiCompatible(Encoding enc, byte[]bytes, int p, int len) { int end = p + len; while (p < end) { int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) return CR_BROKEN; p += cl; } return p > end ? CR_BROKEN : CR_VALID; }
public static int codePoint(Encoding enc, byte[] bytes, int p, int end) { if (p >= end) throw new IllegalArgumentException("empty string"); int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) throw new IllegalArgumentException("invalid byte sequence in " + enc); return enc.mbcToCode(bytes, p, end); }
public static int preciseCodePoint(Encoding enc, byte[]bytes, int p, int end) { int l = preciseLength(enc, bytes, p, end); if (l > 0) return enc.mbcToCode(bytes, p, end); return -1; }
public static int codePoint(Encoding enc, byte[] bytes, int p, int end) { if (p >= end) throw new IllegalArgumentException("empty string"); int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) throw new IllegalArgumentException("invalid byte sequence in " + enc); return enc.mbcToCode(bytes, p, end); }
public static long strLengthWithCodeRangeNonAsciiCompatible(Encoding enc, byte[]bytes, int p, int end) { int cr = 0, c; for (c = 0; p < end; c++) { int cl = preciseLength(enc, bytes, p, end); if (cl > 0) { cr |= CR_VALID; p += cl; } else { cr = CR_BROKEN; p++; } } return pack(c, cr == 0 ? CR_7BIT : cr); }
public static int preciseCodePoint(Encoding enc, byte[]bytes, int p, int end) { int l = preciseLength(enc, bytes, p, end); if (l > 0) return enc.mbcToCode(bytes, p, end); return -1; }
public static int preciseCodePoint(Encoding enc, byte[]bytes, int p, int end) { int l = preciseLength(enc, bytes, p, end); if (l > 0) enc.mbcToCode(bytes, p, end); return -1; }
public static int preciseCodePoint(Encoding enc, byte[]bytes, int p, int end) { int l = preciseLength(enc, bytes, p, end); if (l > 0) enc.mbcToCode(bytes, p, end); return -1; }
public static long strLengthWithCodeRangeNonAsciiCompatible(Encoding enc, byte[]bytes, int p, int end) { int cr = 0, c; for (c = 0; p < end; c++) { int cl = preciseLength(enc, bytes, p, end); if (cl > 0) { cr |= CR_VALID; p += cl; } else { cr = CR_BROKEN; p++; } } return pack(c, cr == 0 ? CR_7BIT : cr); }
private static long strLengthWithCodeRangeNonAsciiCompatible(Encoding enc, byte[]bytes, int p, int end) { int cr = 0, c = 0; for (c = 0; p < end; c++) { int cl = preciseLength(enc, bytes, p, end); if (cl > 0) { cr |= CR_VALID; p += cl; } else { cr = CR_BROKEN; p++; } } return pack(c, cr == 0 ? CR_7BIT : cr); }
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); }
private static int codeRangeScanAsciiCompatible(Encoding enc, byte[]bytes, int p, int len) { int end = p + len; p = searchNonAscii(bytes, p, end); if (p == -1) return CR_7BIT; while (p < end) { int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) return CR_BROKEN; p += cl; if (p < end) { p = searchNonAscii(bytes, p, end); if (p == -1) return CR_VALID; } } return p > end ? CR_BROKEN : CR_VALID; }
public static int codePoint(Ruby runtime, Encoding enc, byte[]bytes, int p, int end) { if (p >= end) throw runtime.newArgumentError("empty string"); int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) throw runtime.newArgumentError("invalid byte sequence in " + enc); return enc.mbcToCode(bytes, p, end); }
public static int codePoint(Ruby runtime, Encoding enc, byte[]bytes, int p, int end) { if (p >= end) throw runtime.newArgumentError("empty string"); int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) throw runtime.newArgumentError("invalid byte sequence in " + enc); return enc.mbcToCode(bytes, p, end); }
public static long getAscii(Encoding enc, byte[]bytes, int p, int end, int len) { if (p >= end) return pack(-1, len); if (enc.isAsciiCompatible()) { int c = bytes[p] & 0xff; if (!Encoding.isAscii(c)) return pack(-1, len); return pack(c, len == 0 ? 0 : 1); } else { int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) return pack(-1, len); int c = enc.mbcToCode(bytes, p, end); if (!Encoding.isAscii(c)) return pack(-1, len); return pack(c, len == 0 ? 0 : cl); } }
public static long getAscii(Encoding enc, byte[]bytes, int p, int end, int len) { if (p >= end) return pack(-1, len); if (enc.isAsciiCompatible()) { int c = bytes[p] & 0xff; if (!Encoding.isAscii(c)) return pack(-1, len); return pack(c, len == 0 ? 0 : 1); } else { int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) return pack(-1, len); int c = enc.mbcToCode(bytes, p, end); if (!Encoding.isAscii(c)) return pack(-1, len); return pack(c, len == 0 ? 0 : cl); } }