Package java.nio

Examples of java.nio.CharBuffer.clear()


            }
        } else {
            errln("Overflow buffer error while decoding UTF32LE should have occurred.");
        }
       
        us.clear();
        bs.clear();
        //test malform buffer
        bs.put((byte)0x02); bs.put((byte)0xD9); bs.put((byte)0x00); bs.put((byte)0x00);
        us.put((char)0x0000);
       
View Full Code Here


            smBufDecode(decoder, "UTF-32LE", bs, us, true, false);
            errln("Malform exception while decoding UTF32LE (2) should have been thrown.");
        } catch (Exception ex) {
        }
       
        us.clear();
        bs.clear();
        //test malform buffer
        bs.put((byte)0xFF); bs.put((byte)0xFE); bs.put((byte)0x00); bs.put((byte)0x00);
        bs.put((byte)0xFF); bs.put((byte)0xDF); bs.put((byte)0x10);
        us.put((char)0x0000);
View Full Code Here

            smBufDecode(decoder, "UTF-32LE", bs, us, true, true);
            errln("Malform exception while decoding UTF32LE (3) should have been thrown.");
        } catch (Exception ex) {
        }
       
        us.clear();
        bs.clear();
        //test malform buffer
        bs.put((byte)0xFF); bs.put((byte)0xFE); bs.put((byte)0x00); bs.put((byte)0x00);
        bs.put((byte)0x02); bs.put((byte)0xD9); bs.put((byte)0x00); bs.put((byte)0x00);
        us.put((char)0x0000);
View Full Code Here

            smBufDecode(decoder, "UTF-32LE", bs, us, true, false);
            errln("Malform exception while decoding UTF32LE (4) should have been thrown.");
        } catch (Exception ex) {
        }
       
        us.clear();
        bs.clear();
        //test overflow buffer
        bs.put((byte)0xFF); bs.put((byte)0xFE); bs.put((byte)0x00); bs.put((byte)0x00);
        bs.put((byte)0xDD); bs.put((byte)0xFF); bs.put((byte)0x10); bs.put((byte)0x00);
        us.put((char)0x0000);
View Full Code Here

        } catch (Exception ex) {
        }
        //end of decode UTF32LE
       
        bs.clear();
        us.clear();
       
        //decode UTF32BE
        decoder = provider.charsetForName("UTF-32BE").newDecoder();
        //test overflow buffer
        bs.put((byte)0x00); bs.put((byte)0x01); bs.put((byte)0xFF); bs.put((byte)0x41);
View Full Code Here

                c = s.charAt(i);
                if (c != '%')
                    break;
            }
            bb.flip();
            cb.clear();
            dec.reset();
            CoderResult cr = dec.decode(bb, cb, true);
            assert cr.isUnderflow();
            cr = dec.flush(cb);
            assert cr.isUnderflow();
View Full Code Here

    assertContentEquals(buf, readonly);

    // readonly's position, mark, and limit should be independent to buf
    readonly.reset();
    assertEquals(readonly.position(), 0);
    readonly.clear();
    assertEquals(buf.position(), buf.limit());
    buf.reset();
    assertEquals(buf.position(), 0);

    buf.clear();
View Full Code Here

    assertContentEquals(buf, readonly);

    // readonly's position, mark, and limit should be independent to buf
    readonly.reset();
    assertEquals(readonly.position(), originalPosition);
    readonly.clear();
    assertEquals(buf.position(), buf.limit());
    buf.reset();
    assertEquals(buf.position(), originalPosition);
  }
View Full Code Here

    assertTrue(buf.capacity() > SMALL_TEST_LENGTH);
    buf.clear();
    CharBuffer other = CharBuffer.allocate(buf.capacity());
    other.put(buf);
    other.clear();
    buf.clear();
    assertEquals(0, buf.compareTo(other));
    assertEquals(0, other.compareTo(buf));
    buf.position(1);
    assertTrue(buf.compareTo(other) > 0);
View Full Code Here

    // duplicate's position, mark, and limit should be independent to
    // buf
    duplicate.reset();
    assertEquals(duplicate.position(), 0);
    duplicate.clear();
    assertEquals(buf.position(), buf.limit());
    buf.reset();
    assertEquals(buf.position(), 0);

    // mark another position
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.