Package java.nio

Examples of java.nio.Buffer.limit()


        h.check(true, "position: can't be negative");
      }

    // 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");
      }
View Full Code Here


    // and position should be set to new limit
    buf = factory.newInstance();
    buf.position(5);
    buf.mark();
    buf.position(6);
    buf.limit(4);
    checkStatus(h, buf, "limit", 10, 4, false, 0, 4);
    try
      {
        buf.reset();
        h.check(false, "limit: mark not invalidated");
View Full Code Here

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

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

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

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

        h.check(true, "position: can't be negative");
      }

    // 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");
      }
View Full Code Here

    buf = factory.newInstance();
    buf.position(2);
    buf.mark();
    buf.position(3);
    h.check(buf.limit(4), buf, "limit: buf.limit(4)");
    checkStatus(h, buf, "limit", 20, 4, true, 1, 3);
    buf.reset();
    checkStatus(h, buf, "limit", 20, 4, true, 2, 2);

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

    // and position should be set to new limit
    buf = factory.newInstance();
    buf.position(5);
    buf.mark();
    buf.position(6);
    buf.limit(4);
    checkStatus(h, buf, "limit", 20, 4, false, 0, 4);
    try
      {
        buf.reset();
        h.check(false, "limit: mark not invalidated");
View Full Code Here

    // limit can't be negative
    buf = factory.newInstance();
    try
      {
        buf.limit(-1);
        h.check(false, "limit: is negative");
      }
      catch(IllegalArgumentException iae)
      {
        h.check(true, "limit: can't be negative");
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.