Package org.jcodings.transcode

Examples of org.jcodings.transcode.EConvResult


            outBytes.ensure((int)outputByteEnd);

            inPtr.p = inBytes.getBegin();
            outPtr.p = outBytes.getBegin() + outputByteoffset;
            int os = outPtr.p + outputBytesize;
            EConvResult res = ec.convert(inBytes.getUnsafeBytes(), inPtr, inBytes.getRealSize() + inPtr.p, outBytes.getUnsafeBytes(), outPtr, os, flags);

            outBytes.setRealSize(outPtr.p - outBytes.begin());

            if (input != null) {
                input.getByteList().setRealSize(inBytes.getRealSize() - (inPtr.p - inBytes.getBegin()));
                input.getByteList().setBegin(inPtr.p);
            }

            if (outputBytesizeObj.isNil() && res == EConvResult.DestinationBufferFull) {
                if (Integer.MAX_VALUE / 2 < outputBytesize) {
                    throw runtime.newArgumentError("too long conversion result");
                }
                outputBytesize *= 2;
                outputByteOffsetObj = context.nil;
                continue;
            }

            if (ec.destinationEncoding != null) {
                outBytes.setEncoding(ec.destinationEncoding);
            }

            return runtime.newSymbol(res.symbolicName());
        }
    }
View Full Code Here


        int ds = 0;
        int ss = sByteList.getBegin();
        byte[] dBytes;
        Ptr dp = new Ptr(0);
        int de = 0;
        EConvResult res;
        int maxOutput;

        if (dst == null) {
            dst = new ByteList(len);
            if (ec.destinationEncoding != null) {
View Full Code Here

        Ptr sp = new Ptr(strByteList.getBegin());
        int start = sp.p;

        byte[] destbytes;
        Ptr dp = new Ptr(0);
        EConvResult ret;
        int convertedOutput = 0;

        destbytes = newStr.getUnsafeBytes();
        int dest = newStr.begin();
        dp.p = dest + convertedOutput;
View Full Code Here

        Ptr outStart = new Ptr(outPos.p);

        // resume:
        while (true) {
            EConvResult ret = ec.convert(inBytes, inPos, inStop, outBytes, outPos, outStop.p, 0);

            if (!fallback.isNil() && ret == EConvResult.UndefinedConversion) {
                IRubyObject rep = RubyString.newStringNoCopy(
                        runtime,
                        new ByteList(
View Full Code Here

    }

    private Object fillCbuf(ThreadContext context, int ec_flags) {
        int ss, se;
        int ds, de;
        EConvResult res;
        int putbackable;
        int cbuf_len0;
        RaiseException exc;

        ec_flags |= EConvFlags.PARTIAL_INPUT;
View Full Code Here

    IRubyObject finishWriteconv(ThreadContext context, boolean noalloc) {
        byte[] dsBytes;
        int ds, de;
        Ptr dpPtr = new Ptr();
        EConvResult res;

        boolean locked = lock();
        try {
            if (wbuf.ptr == null) {
                byte[] buf = new byte[1024];
View Full Code Here

TOP

Related Classes of org.jcodings.transcode.EConvResult

Copyright © 2018 www.massapicom. 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.