Package java.nio

Examples of java.nio.ByteBuffer.position()


    while (hasNext()) {
      p = getPosition();
      ByteBuffer buffer = next();

      s = (Long) SECONDS.read(buffer, buffer.position());
      m = (Long) MICROS.read(buffer, buffer.position());

      if (s > seconds || (s == seconds && m >= micros)) {
        setPosition(p);

        return SeekResult.Fullfilled;
View Full Code Here


        + included);
    b.order(editor.order());

    PcapPacketRecordImpl.initBuffer(b, included, original, seconds, micros);

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

    editor.add(b, position);
View Full Code Here

    final ByteBuffer b = ByteBuffer.allocate(PcapPacketRecord.HEADER_LENGTH
        + included);

    PcapPacketRecordImpl.initBuffer(b, included, original, seconds, micros);

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

    return b;
  }
View Full Code Here

    }

    final ByteBuffer buffer = blockBuffer.getByteBuffer();

    buffer.limit(p + lengthGetter.getMinLength());
    buffer.position(p);

    return blockBuffer;
  }

  /*
 
View Full Code Here

    // existing record from buffer
    final ByteBuffer original = this.get(global, headerReader);

    // its length
    final int length = original.limit() - original.position();

    // create new buffer by copy of the original
    final PartialLoader loader = new MemoryCacheLoader(original, copy,
        headerReader);
View Full Code Here

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

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

    return b;
  }

  /**
 
View Full Code Here

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

    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

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

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

    return b;
  }

  public final int getRecordDataLength() throws IOException {
View Full Code Here

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

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

    return b;
  }

  public abstract int getRecordHeaderLength();
View Full Code Here

  public abstract int getRecordHeaderLength();

  public long getRecordLength() throws IOException {
    final ByteBuffer b = getRecordBuffer();
    final int length = (int) b.limit() - b.position();

    return length;
  }

  public final long getRecordStart() {
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.