Package java.nio

Examples of java.nio.ByteBuffer.limit()


  public ByteBuffer getRecordDataBuffer() throws IOException {

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

  public final ByteBuffer getRecordHeaderBuffer() throws IOException {
    final ByteBuffer b = this.getRecordBuffer();
    final int start = offset;
    final int length = this.getRecordHeaderLength();

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

    return b;
  }
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

    ByteBuffer b = ByteBuffer.allocate(128);
    b.order(ByteOrder.LITTLE_ENDIAN);

    in.read(b, in.size() - b.remaining());

    final long size = b.getInt(b.limit() - 4);

    in.close();

    return size;
  }
View Full Code Here

    ByteBuffer b = ByteBuffer.allocate(128);
    b.order(ByteOrder.LITTLE_ENDIAN);

    in.read(b, in.size() - b.remaining());

    final long size = b.getInt(b.limit() - 8);

    in.close();

    return (size < 0 ? ((long) Integer.MAX_VALUE )* 2L + 1 + size : size);
  }
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

   * @return a byte buffer that is wrapped around this buffers data
   */
  public ByteBuffer toByteBuffer() {
    ByteBuffer b = delagate.duplicate();

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

    return b;
  }

View Full Code Here

   */
  public ByteBuffer getRecordDataBuffer() throws IOException {

    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 + getRecordHeaderLength();
    final int length = b.limit() - start;

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

    return b;
  }
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.