Package net.tomp2p.storage

Examples of net.tomp2p.storage.AlternativeCompositeByteBuf.capacity()


    cbuf.readBytes(me);
    cbuf.readByte();

    System.err.println("reader: " + cbuf.readerIndex());
    System.err.println("writer: " + cbuf.writerIndex());
    System.err.println("capacity: " + cbuf.capacity());
    // see https://github.com/netty/netty/issues/1976
    cbuf.discardSomeReadBytes();
  }

  /**
 
View Full Code Here


  public void compositeBufferTest1() {
    AlternativeCompositeByteBuf cbuf = AlternativeCompositeByteBuf.compBuffer();
    cbuf.writeInt(1);
    ByteBuf buf = Unpooled.buffer();
    buf.writeInt(2);
    cbuf.capacity(4);
    cbuf.addComponent(buf);
    cbuf.writerIndex(8);

    Assert.assertEquals(1, cbuf.readInt());
    Assert.assertEquals(2, cbuf.readInt());
View Full Code Here

  public void compositeBufferTest2() {
    AlternativeCompositeByteBuf cbuf = AlternativeCompositeByteBuf.compBuffer();
    int len = 8 * 4;
    for (int i = 0; i < len; i += 4) {
      ByteBuf buf = Unpooled.buffer().writeInt(i);
      cbuf.capacity(cbuf.writerIndex()).addComponent(buf)
          .writerIndex(i + 4);
    }
    cbuf.writeByte(1);

    byte[] me = new byte[len];
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.