Examples of CoderResult


Examples of java.nio.charset.CoderResult

            int expectedLength = (int) ( buf.remaining() * decoder.averageCharsPerByte() ) + 1;
            CharBuffer out = CharBuffer.allocate( expectedLength );
            for( ;; )
            {
                CoderResult cr;
                if ( buf.hasRemaining() )
                {
                    cr = decoder.decode( buf, out, true );
                }
                else
                {
                    cr = decoder.flush( out );
                }
               
                if ( cr.isUnderflow() )
                {
                    break;
                }
               
                if ( cr.isOverflow() )
                {
                    CharBuffer o = CharBuffer.allocate( out.capacity() + expectedLength );
                    out.flip();
                    o.put(out);
                    out = o;
                    continue;
                }

                cr.throwException();
            }
           
            buf.limit( oldLimit );
            buf.position( end );
            return out.flip().toString();
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.