Package org.jruby.util

Examples of org.jruby.util.CharsetTranscoder


    // Missing flags and doubling readTranscoder as transcoder and whether transcoder has been initializer (ick).
    private void makeReadConversion(ThreadContext context) {
        if (readTranscoder != null) return;
       
        if (writeEncoding != null) {
            readTranscoder = new CharsetTranscoder(context, readEncoding, writeEncoding, transcodingActions);
        } else {
            Encoding ascii8bit = context.runtime.getEncodingService().getAscii8bitEncoding();
           
            readTranscoder = new CharsetTranscoder(context, ascii8bit, ascii8bit, transcodingActions);
        }
    }
View Full Code Here


        Encoding ascii8bit = context.runtime.getEncodingService().getAscii8bitEncoding();
       
        if (readEncoding == null || (readEncoding == ascii8bit  && writeEncoding == null)) { // No encoding conversion
            // Leave for extra MRI bittwiddling which is missing from our IO
            // Hack to initialize transcoder but do no transcoding
            writeTranscoder = new CharsetTranscoder(context, ascii8bit, ascii8bit, transcodingActions);
        } else {
            Encoding fromEncoding = readEncoding;
            Encoding toEncoding;
            if (writeEncoding != null) {
                toEncoding = writeEncoding;
            } else {
                fromEncoding = null;
                toEncoding = readEncoding;
            }
            // If no write then default -> readEncoding
            // If write then writeEncoding -> readEncoding
            // If no read (see if above)
            writeTranscoder = new CharsetTranscoder(context, toEncoding, fromEncoding, transcodingActions);
        }
    }
View Full Code Here

TOP

Related Classes of org.jruby.util.CharsetTranscoder

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.