Examples of unsafeBytes()


Examples of org.jruby.util.ByteList.unsafeBytes()

            fptr.checkClosed();

            str = EncodingUtils.setStrBuf(runtime, str, ilen);
            ByteList strByteList = ((RubyString) str).getByteList();
            n = OpenFile.readInternal(context, fptr, fptr.fd(), strByteList.unsafeBytes(), strByteList.begin(), ilen);

            if (n == -1) {
                throw runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
            }
        } finally {
View Full Code Here

Examples of org.jruby.util.ByteList.unsafeBytes()

        Encoding enc;
        RubyArray ary = null;

        str = RubyString.newString(runtime, str.getByteList().dup());
        ByteList strByteList = str.getByteList();
        ptrBytes = strByteList.unsafeBytes();
        ptr = strByteList.begin();
        len = strByteList.getRealSize();
        enc = str.getEncoding();

        if (block.isGiven()) {
View Full Code Here

Examples of org.jruby.util.ByteList.unsafeBytes()

        if (singleByteOptimizable())
            return enumerateBytes(context, name, block, wantarray);

        str = RubyString.newString(runtime, str.getByteList().dup());
        ByteList strByteList = str.getByteList();
        ptrBytes = strByteList.unsafeBytes();
        ptr = strByteList.begin();
        end = ptr + strByteList.getRealSize();
        enc = str.getEncoding();

        if (block.isGiven()) {
View Full Code Here

Examples of org.jruby.util.ByteList.unsafeBytes()

        int blen = slen + 30;
        dest = RubyString.newStringLight(runtime, blen);
        ByteList destp = ((RubyString)dest).getByteList();

        byte[] frompBytes = fromp.unsafeBytes();
        byte[] destpBytes = destp.unsafeBytes();
        Ptr frompPos = new Ptr(fromp.getBegin());
        Ptr destpPos = new Ptr(destp.getBegin());
        transcodeLoop(context, frompBytes, frompPos, destpBytes, destpPos, frompPos.p + slen, destpPos.p + blen, destp, strTranscodingResize, sname_p[0], dname_p[0], ecflags, ecopts);

        if (frompPos.p != sp.begin() + slen) {
View Full Code Here

Examples of org.jruby.util.ByteList.unsafeBytes()

                        rbuf.off += pending;
                        rbuf.len -= pending;
                    } else {
                        ((RubyString) str).resize(len + pending);
                        strByteList = ((RubyString) str).getByteList();
                        readBufferedData(strByteList.unsafeBytes(), strByteList.begin() + len, pending);
                    }
                    len += pending;
                    if (cr != StringSupport.CR_BROKEN)
                        pos += StringSupport.codeRangeScanRestartable(enc, strByteList.unsafeBytes(), strByteList.begin() + pos, strByteList.begin() + len, cr);
                    if (e != -1) break;
View Full Code Here

Examples of org.jruby.util.ByteList.unsafeBytes()

                        strByteList = ((RubyString) str).getByteList();
                        readBufferedData(strByteList.unsafeBytes(), strByteList.begin() + len, pending);
                    }
                    len += pending;
                    if (cr != StringSupport.CR_BROKEN)
                        pos += StringSupport.codeRangeScanRestartable(enc, strByteList.unsafeBytes(), strByteList.begin() + pos, strByteList.begin() + len, cr);
                    if (e != -1) break;
                }
                READ_CHECK(context);
            } while (fillbuf(context) >= 0);
            if (str == null) return context.nil;
View Full Code Here

Examples of org.jruby.util.ByteList.unsafeBytes()

                }
                bytes += n;
                ByteList strByteList = ((RubyString) str).getByteList();
                strByteList.setRealSize(bytes);
                if (cr != StringSupport.CR_BROKEN)
                    pos += StringSupport.codeRangeScanRestartable(enc, strByteList.unsafeBytes(), strByteList.begin() + pos, strByteList.begin() + bytes, cr);
                if (bytes < siz) break;
                siz += BUFSIZ;
                ((RubyString) str).modify(BUFSIZ);
            }
            str = EncodingUtils.ioEncStr(runtime, str, this);
View Full Code Here

Examples of org.jruby.util.ByteList.unsafeBytes()

        int len;
        BufreadArg arg = new BufreadArg();

        str = EncodingUtils.setStrBuf(context.runtime, str, offset + size);
        ByteList strByteList = ((RubyString)str).getByteList();
        arg.strPtrBytes = strByteList.unsafeBytes();
        arg.strPtr = strByteList.begin() + offset;
        arg.len = size;
        arg.fptr = this;
        // we don't support string locking
//        rb_str_locktmp_ensure(str, bufread_call, (VALUE)&arg);
View Full Code Here

Examples of org.jruby.util.ByteList.unsafeBytes()

                rbuf.off = rbuf.capa - rbuf.len;
            }
            rbuf.off -= (int) len;
            rbuf.len += (int) len;
            ByteList strByteList = ((RubyString) str).getByteList();
            System.arraycopy(strByteList.unsafeBytes(), strByteList.begin(), rbuf.ptr, rbuf.off, len);
        } finally {
            if (locked) unlock();
        }
    }
View Full Code Here

Examples of org.jruby.util.ByteList.unsafeBytes()

                        if (fillbuf(context) != -1) {
                            ((RubyString)str).cat(rbuf.ptr[rbuf.off]);
                            rbuf.off++;
                            rbuf.len--;
                            ByteList strByteList = ((RubyString)str).getByteList();
                            r = StringSupport.preciseLength(enc, strByteList.unsafeBytes(), strByteList.getBegin(), strByteList.getBegin() + strByteList.length());
                            if (StringSupport.MBCLEN_NEEDMORE_P(r)) {
                                continue getc_needmore;
                            }
                            else if (StringSupport.MBCLEN_CHARFOUND_P(r)) {
                                cr = StringSupport.CR_VALID;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.