Examples of newDecoder()


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

        private void writeTo(Writer out, String encoding) throws IOException{
            //Get the charset based on the encoding or return the default if
            //encoding == null
            Charset charset = (encoding == null) ?
                    Charset.defaultCharset() : Charset.forName(encoding);
            CharsetDecoder decoder = charset.newDecoder();
            CharBuffer decodedBuffer = decoder.decode(
                    ByteBuffer.wrap(_byteArrayOutputStream.getInnerArray(),
                            0,_byteArrayOutputStream.getInnerCount()));
            if (decodedBuffer.hasArray()){
                out.write(decodedBuffer.array());
View Full Code Here

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

   
    public void refreshComments() {
        Charset latin1 = Charset.forName("ISO-8859-1");
        CharsetDecoder decoder = null;
        if (latin1 != null)
            decoder = latin1.newDecoder();
        if (_ss != null) {
            _scomments = _map.getServiceComments(_ss.getHostName(), _ss.getServiceDescription());
            if (_scomments != null) {
               DefaultTableModel model = (DefaultTableModel)jTableComments.getModel();
               int rows = jTableComments.getRowCount();
View Full Code Here

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

   
    public void refreshComments() {
        Charset latin1 = Charset.forName("ISO-8859-1");
        CharsetDecoder decoder = null;
        if (latin1 != null)
            decoder = latin1.newDecoder();
        ImageIcon hostIcon = _map.getIcon_Vertex(_h.getName()).getOriginal();
        if (hostIcon != null) {
            jLblHostImage.setIcon(hostIcon);
        }
 
View Full Code Here

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

        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.newDecoder()

        this.contentType = contentType != null ? contentType : ContentType.DEFAULT_TEXT;
        Charset charset = this.contentType.getCharset();
        if (charset == null) {
            charset = HTTP.DEF_CONTENT_CHARSET;
        }
        this.chardecoder = charset.newDecoder();
        this.bbuf = ByteBuffer.allocate(this.bufSize);
        this.cbuf = CharBuffer.allocate(this.bufSize);
    }

    @Override
View Full Code Here

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

        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();
        buf.putString("hello", charset.newEncoder());
        buf.flip();
        assertEquals("hello", buf.getString(charset.newDecoder()));
View Full Code Here

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

        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();
        buf.put((byte) 'A');
        buf.put((byte) 'B');
View Full Code Here

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

        Charset charset = getCharset();

        // Common case: charset is same as last time, so
        // just reuse it:
        if (lastCharset == null || !charset.equals(lastCharset)) {
            decoder = charset.newDecoder();
            decoder.onMalformedInput(CodingErrorAction.REPLACE);
            decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
            lastCharset = charset;
        }
View Full Code Here

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

        FileUtil.copyContents( input, out );

        ByteBuffer     bbuf        = ByteBuffer.wrap( out.toByteArray() );

        Charset        cset        = Charset.forName( encoding );
        CharsetDecoder csetdecoder = cset.newDecoder();

        csetdecoder.onMalformedInput( CodingErrorAction.REPORT );
        csetdecoder.onUnmappableCharacter( CodingErrorAction.REPORT );

        try
View Full Code Here

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

            return cbuf.toString();
        }
        catch( CharacterCodingException e )
        {
            Charset        latin1    = Charset.forName("ISO-8859-1");
            CharsetDecoder l1decoder = latin1.newDecoder();

            l1decoder.onMalformedInput( CodingErrorAction.REPORT );
            l1decoder.onUnmappableCharacter( CodingErrorAction.REPORT );

            try
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.