Examples of newEncoder()


Examples of java.nio.charset.Charset.newEncoder()

            b[3] = (byte)(char1 & 0xff);
            return b;
        }
        try {
            Charset cc = Charset.forName(encoding);
            CharsetEncoder ce = cc.newEncoder();
            ce.onUnmappableCharacter(CodingErrorAction.IGNORE);
            CharBuffer cb = CharBuffer.wrap(new char[]{char1});
            java.nio.ByteBuffer bb = ce.encode(cb);
            bb.rewind();
            int lim = bb.limit();
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

        outStream = new BufferedOutputStream(new FileOutputStream(inputFile+".temp"));
        File file = new File(inputFile+".temp");
            raf = new RandomAccessFile(file, "r");
           
            Charset internalCharset = Charset.forName(DEFAULT_INTERNAL_ENCODING);
            encoder = internalCharset.newEncoder();
        decoder = internalCharset.newDecoder();
        } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

        IoBuffer buf = IoBuffer.allocate(16);
        CharsetDecoder decoder;

        Charset charset = Charset.forName("UTF-8");
        buf.clear();
        buf.putString("hello", charset.newEncoder());
        buf.put((byte) 0);
        buf.flip();
        assertEquals("hello", buf.getString(charset.newDecoder()));

        buf.clear();
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

        buf.put((byte) 0);
        buf.flip();
        assertEquals("hello", buf.getString(charset.newDecoder()));

        buf.clear();
        buf.putString("hello", charset.newEncoder());
        buf.flip();
        assertEquals("hello", buf.getString(charset.newDecoder()));

        decoder = Charset.forName("ISO-8859-1").newDecoder();
        buf.clear();
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

                IoBuffer buffer = IoBuffer.allocate(1);
                buffer.setAutoExpand(true);

                Charset charset = Charset.forName("UTF-8");

                CharsetEncoder encoder = charset.newEncoder();

                for (int i = 0; i < 5; i++) {
                    try {
                        buffer.putString("\u89d2", encoder);
                        buffer.putPrefixedString("\u89d2", encoder);
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

                }
            };

            // set the encoder used for this datagram codec factory
            Charset encoding = getEncodingParameter(type, parameters);
            encoder = encoding.newEncoder();

            if (LOG.isDebugEnabled()) {
                LOG.debug(type + ": Using CodecFactory: " + codecFactory + " using encoding: " + encoding);
            }
        }
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

            try {
                ctb = cache.getCharToByteConverter(codeset.getName());
                if (ctb == null) {
                    Charset tmpCharset = Charset.forName(codeset.getName());
                    ctb = tmpCharset.newEncoder();
                    cache.setConverter(codeset.getName(), ctb);
                }
            } catch(IllegalCharsetNameException icne) {

                // This can only happen if one of our Entries has
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

        }
        if (indentation < 0) {
            throw new IllegalArgumentException("the indentation must be >= 0");
        }
        Charset cs = Charset.forName(charset);
        this.encoder = cs.newEncoder();
        this.charset = charset;
        this.declaration = declaration;
        this.indentation = indentation;
        this.out = new OutputStreamWriter(out, cs.newEncoder());
        valueToExpression = new IdentityHashMap<>();
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

        Charset cs = Charset.forName(charset);
        this.encoder = cs.newEncoder();
        this.charset = charset;
        this.declaration = declaration;
        this.indentation = indentation;
        this.out = new OutputStreamWriter(out, cs.newEncoder());
        valueToExpression = new IdentityHashMap<>();
        targetToStatementList = new IdentityHashMap<>();
        nameGenerator = new NameGenerator();
    }
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

                cconfig.getUnmappableInputAction() : CodingErrorAction.REPORT;
        if (charset != null) {
            chardecoder = charset.newDecoder();
            chardecoder.onMalformedInput(malformedInputAction);
            chardecoder.onUnmappableCharacter(unmappableInputAction);
            charencoder = charset.newEncoder();
            charencoder.onMalformedInput(malformedInputAction);
            charencoder.onUnmappableCharacter(unmappableInputAction);
        }
        return new SocketClientConnectionImpl(bufferSize,
                chardecoder, charencoder,
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.