Package org.jruby.util

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


        Ptr dp = new Ptr(0);
        EConvResult ret;
        int convertedOutput = 0;

        destbytes = newStr.getUnsafeBytes();
        int dest = newStr.begin();
        dp.p = dest + convertedOutput;
        ret = ec.convert(sbytes, sp, start + len, destbytes, dp, dest + olen, 0);
        while (ret == EConvResult.DestinationBufferFull) {
            int convertedInput = sp.p - start;
            int rest = len - convertedInput;
View Full Code Here


                        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

                        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

                        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

                }
                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

                }
                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

        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);
        bufreadCall(context, arg);
View Full Code Here

                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

//            if (len > 0) return len;
//        }
//        #endif
        str = doWriteconv(context, str);
        ByteList strByteList = ((RubyString)str).getByteList();
        return binwrite(context, str, strByteList.unsafeBytes(), strByteList.begin(), strByteList.length(), nosync);
    }

    // do_writeconv
    public IRubyObject doWriteconv(ThreadContext context, IRubyObject str)
    {
View Full Code Here

                rep = fallbackFunc.call(context, fallback, rep);
                if (!rep.isNil()) {
                    rep = rep.convertToString();
                    Encoding repEnc = ((RubyString)rep).getEncoding();
                    ByteList repByteList = ((RubyString)rep).getByteList();
                    ec.insertOutput(repByteList.getUnsafeBytes(), repByteList.begin(), repByteList.getRealSize(), repEnc.getName());

                    // TODO: check for too-large replacement

                    continue;
                }
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.