public static int codePoint(Ruby runtime, Encoding enc, byte[] bytes, int p, int end) { try { return codePoint(enc, bytes, p, end); } catch (IllegalArgumentException e) { throw runtime.newArgumentError(e.getMessage()); } }
public static int codePoint(Ruby runtime, Encoding enc, byte[] bytes, int p, int end) { try { return codePoint(enc, bytes, p, end); } catch (IllegalArgumentException e) { throw runtime.newArgumentError(e.getMessage()); } }
@JRubyMethod public IRubyObject ord(ThreadContext context) { final Ruby runtime = context.runtime; return RubyFixnum.newFixnum(runtime, codePoint(runtime, this.value)); }
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); }
@JRubyMethod public IRubyObject ord(ThreadContext context) { final Ruby runtime = context.runtime; return RubyFixnum.newFixnum(runtime, codePoint(runtime, this.value)); }
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 IRubyObject multiByteLStrip(ThreadContext context, Encoding enc, byte[]bytes, int s, int end) { final Ruby runtime = context.runtime; int p = s; while (p < end) { int c = codePoint(runtime, enc, bytes, p, end); if (!ASCII.isSpace(c)) break; p += codeLength(enc, c); } if (p > s) { view(p - s, end - p); return this; } return context.nil; }
private IRubyObject multiByteLStrip(ThreadContext context, Encoding enc, byte[]bytes, int s, int end) { final Ruby runtime = context.runtime; int p = s; while (p < end) { int c = codePoint(runtime, enc, bytes, p, end); if (!ASCII.isSpace(c)) break; p += codeLength(enc, c); } if (p > s) { view(p - s, end - p); return this; } return context.nil; }
private int choppedLength19(Ruby runtime) { int p = value.getBegin(); int end = p + value.getRealSize(); if (p > end) return 0; byte bytes[] = value.getUnsafeBytes(); Encoding enc = value.getEncoding(); int s = enc.prevCharHead(bytes, p, end, end); if (s == -1) return 0; if (s > p && codePoint(runtime, enc, bytes, s, end) == '\n') { int s2 = enc.prevCharHead(bytes, p, s, end); if (s2 != -1 && codePoint(runtime, enc, bytes, s2, end) == '\r') s = s2; } return s - p; }
private IRubyObject multiByteLStrip(Ruby runtime, Encoding enc, byte[]bytes, int s, int end) { int p = s; while (p < end) { int c = codePoint(runtime, enc, bytes, p, end); if (!ASCII.isSpace(c)) break; p += codeLength(runtime, enc, c); } if (p > s) { view(p - s, end - p); return this; } return runtime.getNil(); }
private IRubyObject multiByteLStrip(Ruby runtime, Encoding enc, byte[]bytes, int s, int end) { int p = s; while (p < end) { int c = codePoint(runtime, enc, bytes, p, end); if (!ASCII.isSpace(c)) break; p += codeLength(runtime, enc, c); } if (p > s) { view(p - s, end - p); return this; } return runtime.getNil(); }
public static int codePoint(final Ruby runtime, final ByteList value) { return codePoint(runtime, EncodingUtils.getEncoding(value), value.getUnsafeBytes(), value.getBegin(), value.getBegin() + value.getRealSize()); }
public static int codePoint(final Ruby runtime, final ByteList value) { return codePoint(runtime, EncodingUtils.getEncoding(value), value.getUnsafeBytes(), value.getBegin(), value.getBegin() + value.getRealSize()); }
@JRubyMethod(name = "ord", compat = RUBY1_9) public IRubyObject ord(ThreadContext context) { Ruby runtime = context.runtime; return RubyFixnum.newFixnum(runtime, codePoint(runtime, value.getEncoding(), value.getUnsafeBytes(), value.getBegin(), value.getBegin() + value.getRealSize())); }
private boolean isPrintable() { Ruby runtime = getRuntime(); int p = symbolBytes.getBegin(); int end = p + symbolBytes.getRealSize(); byte[] bytes = symbolBytes.getUnsafeBytes(); Encoding enc = symbolBytes.getEncoding(); while (p < end) { int c = codePoint(runtime, enc, bytes, p, end); if (!enc.isPrint(c)) return false; p += codeLength(enc, c); } return true; }
@JRubyMethod(name = "ord", compat = RUBY1_9) public IRubyObject ord(ThreadContext context) { Ruby runtime = context.runtime; return RubyFixnum.newFixnum(runtime, codePoint(runtime, value.getEncoding(), value.getUnsafeBytes(), value.getBegin(), value.getBegin() + value.getRealSize())); }
private boolean isPrintable() { Ruby runtime = getRuntime(); int p = symbolBytes.getBegin(); int end = p + symbolBytes.getRealSize(); byte[] bytes = symbolBytes.getUnsafeBytes(); Encoding enc = symbolBytes.getEncoding(); while (p < end) { int c = codePoint(runtime, enc, bytes, p, end); if (!enc.isPrint(c)) return false; p += codeLength(enc, c); } return true; }
private boolean isPrintable() { Ruby runtime = getRuntime(); int p = symbolBytes.getBegin(); int end = p + symbolBytes.getRealSize(); byte[]bytes = symbolBytes.getUnsafeBytes(); Encoding enc = symbolBytes.getEncoding(); while (p < end) { int c = codePoint(runtime, enc, bytes, p, end); if (!enc.isPrint(c)) return false; p += codeLength(runtime, enc, c); } return true; }
private boolean isPrintable() { Ruby runtime = getRuntime(); int p = symbolBytes.getBegin(); int end = p + symbolBytes.getRealSize(); byte[]bytes = symbolBytes.getUnsafeBytes(); Encoding enc = symbolBytes.getEncoding(); while (p < end) { int c = codePoint(runtime, enc, bytes, p, end); if (!enc.isPrint(c)) return false; p += codeLength(runtime, enc, c); } return true; }
private IRubyObject each_codepointCommon(ThreadContext context, Block block) { Ruby runtime = context.runtime; byte bytes[] = value.getUnsafeBytes(); int p = value.getBegin(); int end = p + value.getRealSize(); Encoding enc = value.getEncoding(); while (p < end) { int c = codePoint(runtime, enc, bytes, p, end); int n = codeLength(runtime, enc, c); block.yield(context, runtime.newFixnum(c)); p += n; } return this; }