Package java.nio

Examples of java.nio.Buffer.position()


    Buffer buf = null;

    buf = factory.newInstance();
    buf.position(5);
    buf.mark();
    buf.position(6);
    h.check(buf.flip(), buf, "flip: buf.flip()");
    checkStatus(h, buf, "flip", 10, 6, true, 6, 0);
    try
      {
        buf.reset();
View Full Code Here


  private void position(TestHarness h, BufferFactory factory)
  {
    Buffer buf = null;

    buf = factory.newInstance();
    h.check(buf.position(1), buf,  "position: buf.position(1)");
    checkStatus(h, buf, "position", 20, 20, true, 19, 1);
    buf.position(20);
    checkStatus(h, buf, "position", 20, 20, false, 0, 20);

    // position can't be negative
View Full Code Here

    Buffer buf = null;

    buf = factory.newInstance();
    h.check(buf.position(1), buf,  "position: buf.position(1)");
    checkStatus(h, buf, "position", 20, 20, true, 19, 1);
    buf.position(20);
    checkStatus(h, buf, "position", 20, 20, false, 0, 20);

    // position can't be negative
    buf = factory.newInstance();
    try
View Full Code Here

    // position can't be negative
    buf = factory.newInstance();
    try
      {
        buf.position(-1);
        h.check(false, "position: is negative");
      }
      catch(IllegalArgumentException iae)
      {
        h.check(true, "position: can't be negative");
View Full Code Here

    // position can't be larger than limit
    buf = factory.newInstance();
    buf.limit(5);
    try
      {
        buf.position(6);
        h.check(false, "position: is larger than capacity");
      }
      catch(IllegalArgumentException iae)
      {
        h.check(true, "position: can't be larger than capacity");
View Full Code Here

    // mark at default position
    buf = factory.newInstance();
    h.check(buf.mark(), buf, "mark: buf.mark()");
    checkStatus(h, buf, "mark", 20, 20, true, 10, 10);
    buf.position(15);
    checkStatus(h, buf, "mark", 20, 20, true, 5, 15);
    h.check(buf.reset(), buf, "mark: buf.reset()");
    checkStatus(h, buf, "mark", 20, 20, true, 10, 10);
    buf.position(16);
    checkStatus(h, buf, "mark", 20, 20, true, 4, 16);
View Full Code Here

    checkStatus(h, buf, "mark", 20, 20, true, 10, 10);
    buf.position(15);
    checkStatus(h, buf, "mark", 20, 20, true, 5, 15);
    h.check(buf.reset(), buf, "mark: buf.reset()");
    checkStatus(h, buf, "mark", 20, 20, true, 10, 10);
    buf.position(16);
    checkStatus(h, buf, "mark", 20, 20, true, 4, 16);
    buf.reset();
    checkStatus(h, buf, "mark", 20, 20, true, 10, 10);

    // mark at specified position
View Full Code Here

    buf.reset();
    checkStatus(h, buf, "mark", 20, 20, true, 10, 10);

    // mark at specified position
    buf = factory.newInstance();
    buf.position(5);
    buf.mark();
    checkStatus(h, buf, "mark", 20, 20, true, 15, 5);
    buf.position(6);
    checkStatus(h, buf, "mark", 20, 20, true, 14, 6);
    buf.reset();
View Full Code Here

    // mark at specified position
    buf = factory.newInstance();
    buf.position(5);
    buf.mark();
    checkStatus(h, buf, "mark", 20, 20, true, 15, 5);
    buf.position(6);
    checkStatus(h, buf, "mark", 20, 20, true, 14, 6);
    buf.reset();
    checkStatus(h, buf, "mark", 20, 20, true, 15, 5);
    buf.position(7);
    checkStatus(h, buf, "mark", 20, 20, true, 13, 7);
View Full Code Here

    checkStatus(h, buf, "mark", 20, 20, true, 15, 5);
    buf.position(6);
    checkStatus(h, buf, "mark", 20, 20, true, 14, 6);
    buf.reset();
    checkStatus(h, buf, "mark", 20, 20, true, 15, 5);
    buf.position(7);
    checkStatus(h, buf, "mark", 20, 20, true, 13, 7);
    buf.reset();
    checkStatus(h, buf, "mark", 20, 20, true, 15, 5);

    // mark should be discarded if new position is smaller than mark
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.