public static IRubyObject strEncodeAssociate(ThreadContext context, IRubyObject str, Encoding encidx) { encAssociateIndex(str, encidx); if (encAsciicompat(encidx)) { ((RubyString)str).scanForCodeRange(); } else { ((RubyString)str).setCodeRange(StringSupport.CR_VALID); } return str; }
public static IRubyObject strEncodeAssociate(ThreadContext context, IRubyObject str, Encoding encidx) { encAssociateIndex(str, encidx); if (encAsciicompat(encidx)) { ((RubyString)str).scanForCodeRange(); } else { ((RubyString)str).setCodeRange(StringSupport.CR_VALID); } return str; }
public static IRubyObject strEncodeAssociate(ThreadContext context, IRubyObject str, Encoding encidx) { encAssociateIndex(str, encidx); if (encAsciicompat(encidx)) { ((RubyString)str).scanForCodeRange(); } else { ((RubyString)str).setCodeRange(StringSupport.CR_VALID); } return str; }
public static IRubyObject strEncodeAssociate(ThreadContext context, IRubyObject str, Encoding encidx) { encAssociateIndex(str, encidx); if (encAsciicompat(encidx)) { ((RubyString)str).scanForCodeRange(); } else { ((RubyString)str).setCodeRange(StringSupport.CR_VALID); } return str; }
public IRubyObject shiftCbuf(ThreadContext context, final int len, final IRubyObject strp) { boolean locked = lock(); try { IRubyObject str = null; if (strp != null) { str = strp; if (str.isNil()) { str = RubyString.newString(context.runtime, cbuf.ptr, cbuf.off, len); } else { ((RubyString) str).cat(cbuf.ptr, cbuf.off, len); } str.setTaint(true); EncodingUtils.encAssociateIndex(str, encs.enc); } cbuf.off += len; cbuf.len -= len; /* xxx: set coderange */ if (cbuf.len == 0) cbuf.off = 0; else if (cbuf.capa / 2 < cbuf.off) { System.arraycopy(cbuf.ptr, cbuf.off, cbuf.ptr, 0, cbuf.len); cbuf.off = 0; } return str; } finally { if (locked) unlock(); } }
public IRubyObject shiftCbuf(ThreadContext context, final int len, final IRubyObject strp) { boolean locked = lock(); try { IRubyObject str = null; if (strp != null) { str = strp; if (str.isNil()) { str = RubyString.newString(context.runtime, cbuf.ptr, cbuf.off, len); } else { ((RubyString) str).cat(cbuf.ptr, cbuf.off, len); } str.setTaint(true); EncodingUtils.encAssociateIndex(str, encs.enc); } cbuf.off += len; cbuf.len -= len; /* xxx: set coderange */ if (cbuf.len == 0) cbuf.off = 0; else if (cbuf.capa / 2 < cbuf.off) { System.arraycopy(cbuf.ptr, cbuf.off, cbuf.ptr, 0, cbuf.len); cbuf.off = 0; } return str; } finally { if (locked) unlock(); } }