Package java.nio

Examples of java.nio.ByteBuffer.position()


    final int MAX_HEADER_LENGTH = 24;
    final ByteBuffer view = BufferUtils.duplicate(buffer);
    final int capacity = view.capacity();
    boolean status = true;

    for (int i = 0; i < count && view.position() + MAX_HEADER_LENGTH < capacity; i++) {
      view.mark();
      long length = headerReader.readLength(view);
      int p = view.position() + (int) length;

      if (pattern.match(view) == false) {
View Full Code Here


    boolean status = true;

    for (int i = 0; i < count && view.position() + MAX_HEADER_LENGTH < capacity; i++) {
      view.mark();
      long length = headerReader.readLength(view);
      int p = view.position() + (int) length;

      if (pattern.match(view) == false) {
        status = false;
        break;
      }
View Full Code Here

      if (p + MAX_HEADER_LENGTH > view.capacity()) {
        break;
      }

      view.limit(p + MAX_HEADER_LENGTH);
      view.position(p);
    }

    return status;
  }
View Full Code Here

   */
  public ByteBuffer toByteBuffer() {
    ByteBuffer b = delagate.duplicate();

    b.limit(delagate.limit());
    b.position(delagate.position());

    return b;
  }

  /**
 
View Full Code Here

        + included);

    SnoopPacketRecordImpl.initBuffer(b, included, original, record, drops,
        seconds, micros);

    b.position(SnoopPacketRecord.HEADER_LENGTH);
    b.put(data);
    b.clear();

    return b;
  }
View Full Code Here

    if (bytes != null) {
      return bytes;
    }

    final ByteBuffer b = this.handle.getByteBuffer();
    this.offset = b.position();

    if (autoedit && b.isReadOnly()) {
      final long global = handle.getPositionGlobal();

      editor.replaceInPlace(getPositionGlobal(), true);
View Full Code Here

    if (bytes != null) {
      return bytes;
    }

    final ByteBuffer b = this.handle.getByteBuffer();
    this.offset = b.position();

    return b;
  }

  /**
 
View Full Code Here

    final ByteBuffer b = this.getRecordByteBuffer();
    final int start = offset + getRecordHeaderLength();
    final int length = b.limit() - start;

    b.limit(start + length);
    b.position(start);

    return b;
  }

  /**
 
View Full Code Here

    final ByteBuffer b = this.getRecordByteBuffer();
    final int start = offset;
    final int length = this.getRecordHeaderLength();

    b.limit(start + length);
    b.position(start);

    return b;
  }

  /**
 
View Full Code Here

   * @return
   * @throws IOException
   */
  public long getRecordLength() throws IOException {
    final ByteBuffer b = getRecordByteBuffer();
    final int length = b.limit() - b.position();

    return length;
  }

  /**
 
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.