Package java.nio

Examples of java.nio.CharBuffer.limit()


        //test overflow buffer
        bs.put((byte)0x00); bs.put((byte)0x00); bs.put((byte)0xFE); bs.put((byte)0xFF);
        bs.put((byte)0x00); bs.put((byte)0x10); bs.put((byte)0xFF); bs.put((byte)0xDD);
        us.put((char)0x0000);
       
        us.limit(us.position());
        us.position(0);
        bs.limit(bs.position());
        bs.position(0);
       
        try {
View Full Code Here


        us.clear();
        //test malform buffer
        bs.put((byte)0x00); bs.put((byte)0x00); bs.put((byte)0xFE);
        us.put((char)0x0000);
       
        us.limit(us.position());
        us.position(0);
        bs.limit(bs.position());
        bs.position(0);
       
        try {
View Full Code Here

        result = decoder.decode(bs2, us, true);
        if (!result.isUnderflow() || !equals(us, us2)) {
            errln("Error while decoding UTF-8 (1) should not have occured.");
        }
       
        us2.limit(limit_us);
        us2.position(0);
        bs.limit(limit_bs);
        bs.position(0);
       
        result = encoder.encode(us2, bs, true);
View Full Code Here

        encoder.reset();
        us.put((char)0x0081); us.put((char)0xEF65);
        bs.put((byte)0x00); bs.put((byte)0x00); bs.put((byte)0x00);
        limit_us = us.position();
        us2 = us.asReadOnlyBuffer();
        us2.limit(limit_us);
        us2.position(0);
        bs.limit(1);
        bs.position(0);
        result = encoder.encode(us2, bs, true);
        if (!result.isOverflow()) {
View Full Code Here

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

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

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

        encoder.reset();
        us.put((char)0xD902); us.put((char)0xDD02); us.put((char)0x0041);
        bs.put((byte)0x00); bs.put((byte)0x00); bs.put((byte)0x00); bs.put((byte)0x00);
        limit_us = us.position();
        us2 = us.asReadOnlyBuffer();
        us2.limit(limit_us);
        us2.position(0);
        bs.limit(1);
        bs.position(0);
        result = encoder.encode(us2, bs, true);
        if (!result.isOverflow()) {
View Full Code Here

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

            errln("Overflow Error should have occured while encoding UTF-8 (11).");
        }
       
        encoder.reset();
       
        us2.limit(limit_us);
        us2.position(0);
        bs.limit(3);
        bs.position(0);
        result = encoder.encode(us2, bs, true);
        if (!result.isOverflow()) {
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.