Package java.nio

Examples of java.nio.CharBuffer.limit()


            errln("Overflow Error should have occured while encoding UTF-8 (12).");
        }
       
        encoder.reset();
       
        us2.limit(limit_us);
        us2.position(0);
        bs.limit(4);
        bs.position(0);
        result = encoder.encode(us2, bs, true);
        if (!result.isOverflow()) {
View Full Code Here


       
        //test flush buffer and malform string
        bs.put((byte)0xFF);
        us.put((char)0x0000);
       
        us.limit(us.position());
        us.position(0);
        bs.limit(bs.position());
        bs.position(0);
       
        result = decoder.decode(bs, us, true);
View Full Code Here

        us.clear();
        bs.clear();
       
        us.put((char)0xD902); us.put((char)0xDD01); us.put((char)0x0041);
       
        us.limit(1);
        us.position(0);
        bs.limit(4);
        bs.position(0);
       
        result = encoder.encode(us, bs, true);
View Full Code Here

        us.position(0);
        bs.limit(4);
        bs.position(0);
       
        result = encoder.encode(us, bs, true);
        us.limit(3);
        us.position(0);
        bs.limit(3);
        bs.position(0);
        result = encoder.encode(us, bs, true);
        if (!result.isOverflow()) {
View Full Code Here

        decoder.reset();
        decoder = provider.charsetForName("UTF-16BE").newDecoder();
       
        bs.put((byte)0xFF); bs.put((byte)0xFE); bs.put((byte)0x41);
       
        us.limit(0);
        us.position(0);
        bs.limit(3);
        bs.position(0);
       
        result = decoder.decode(bs, us, true);
View Full Code Here

       
        ByteBuffer bb = ByteBuffer.wrap(bytearray);
        CharBuffer cb = CharBuffer.allocate(10);
       
        bb.limit(4);
        cb.limit(1); // Overflow should occur and is expected
        result = decoder.decode(bb, cb, false);
        if (result.isError()) {
            errln("Error occurred while decoding: " + charsetName + " with error: " + result);
        }
       
View Full Code Here

       
        cb = CharBuffer.wrap(chararray);
        bb = ByteBuffer.allocate(10);
       
        bb.limit(2);
        cb.limit(4);
        result = encoder.encode(cb, bb, false);
        if (result.isError()) {
            errln("Error occurred while encoding: " + charsetName + " with error: " + result);
        }
        cb.limit(5);
View Full Code Here

        cb.limit(4);
        result = encoder.encode(cb, bb, false);
        if (result.isError()) {
            errln("Error occurred while encoding: " + charsetName + " with error: " + result);
        }
        cb.limit(5);
        result = encoder.encode(cb, bb, false);
        if (result.isError()) {
            errln("Error occurred while encoding: " + charsetName + " with error: " + result);
        }
        cb.limit(6);
View Full Code Here

        cb.limit(5);
        result = encoder.encode(cb, bb, false);
        if (result.isError()) {
            errln("Error occurred while encoding: " + charsetName + " with error: " + result);
        }
        cb.limit(6);
        result = encoder.encode(cb, bb, true);
        if (!result.isError()) {
            errln("Error should have occurred while encoding: " + charsetName);
        }
    }
View Full Code Here

        ByteBuffer bs = ByteBuffer.allocate(bs_array1.length);
       
        us.put(us_array);
        bs.put(bs_array1);
       
        us.limit(us.position());
        us.position(0);
        bs.limit(bs.position());
        bs.position(0);
           
        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.