Package java.nio

Examples of java.nio.Buffer.position()


  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", 10, 10, true, 9, 1);
    buf.position(10);
    checkStatus(h, buf, "position", 10, 10, false, 0, 10);

    // 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", 10, 10, true, 9, 1);
    buf.position(10);
    checkStatus(h, buf, "position", 10, 10, false, 0, 10);

    // 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", 10, 10, true, 10, 0);
    buf.position(5);
    checkStatus(h, buf, "mark", 10, 10, true, 5, 5);
    h.check(buf.reset(), buf, "mark: buf.reset()");
    checkStatus(h, buf, "mark", 10, 10, true, 10, 0);
    buf.position(6);
    checkStatus(h, buf, "mark", 10, 10, true, 4, 6);
View Full Code Here

    checkStatus(h, buf, "mark", 10, 10, true, 10, 0);
    buf.position(5);
    checkStatus(h, buf, "mark", 10, 10, true, 5, 5);
    h.check(buf.reset(), buf, "mark: buf.reset()");
    checkStatus(h, buf, "mark", 10, 10, true, 10, 0);
    buf.position(6);
    checkStatus(h, buf, "mark", 10, 10, true, 4, 6);
    buf.reset();
    checkStatus(h, buf, "mark", 10, 10, true, 10, 0);

    // mark at specified position
View Full Code Here

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

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

    // mark at specified position
    buf = factory.newInstance();
    buf.position(5);
    buf.mark();
    checkStatus(h, buf, "mark", 10, 10, true, 5, 5);
    buf.position(6);
    checkStatus(h, buf, "mark", 10, 10, true, 4, 6);
    buf.reset();
    checkStatus(h, buf, "mark", 10, 10, true, 5, 5);
    buf.position(7);
    checkStatus(h, buf, "mark", 10, 10, true, 3, 7);
View Full Code Here

    checkStatus(h, buf, "mark", 10, 10, true, 5, 5);
    buf.position(6);
    checkStatus(h, buf, "mark", 10, 10, true, 4, 6);
    buf.reset();
    checkStatus(h, buf, "mark", 10, 10, true, 5, 5);
    buf.position(7);
    checkStatus(h, buf, "mark", 10, 10, true, 3, 7);
    buf.reset();
    checkStatus(h, buf, "mark", 10, 10, true, 5, 5);

    // mark should be discarded if new position is smaller than mark
View Full Code Here

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

    // mark should be discarded if new position is smaller than mark
    buf = factory.newInstance();
    buf.position(5);
    buf.mark();
    buf.position(4);
    try
      {
        buf.reset();
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.