Package com.cetsoft.imcache.cache.offheap.bytebuffer

Examples of com.cetsoft.imcache.cache.offheap.bytebuffer.OffHeapByteBuffer


  public void storeWithBuffer(){
    int size = 100;
    byte[] bytes = new byte[size];
    random.nextBytes(bytes);
    doReturn(pointer).when(bufferStore).store(bytes);
    doReturn(buffer).doReturn(new OffHeapByteBuffer(0, 10)).when(bufferStore).currentBuffer();
    doNothing().when(bufferStore).nextBuffer();
    bufferStore.store(bytes, buffer);
    verify(bufferStore).store(bytes);
    verify(bufferStore).nextBuffer();
  }
View Full Code Here


   *
   * @param args the arguments
   */
  public static void main(String[] args) {
    int length = 5, x = 4, y = 3;
    OffHeapByteBuffer buffer = new OffHeapByteBuffer(0,1000);
    SimpleObject object = new SimpleObject(x, y);
    for (int i = 0; i < length; i++) {
      byte [] payload = serialize(object);
      Pointer pointer = buffer.store(payload);
      SimpleObject simpleObject = deserialize(buffer.retrieve(pointer));
      if(object.getX()!=simpleObject.getX()&&object.getY()!=simpleObject.getY()){
        System.err.println("Problem");
      }
    }
    Pointer pointer = buffer.update(new Pointer(115, buffer), new byte[200]);
    if(buffer.retrieve(pointer).length!=200){
      System.err.println("Problem");
    }
    buffer.retrieve(new Pointer(115, buffer));
  }
View Full Code Here

TOP

Related Classes of com.cetsoft.imcache.cache.offheap.bytebuffer.OffHeapByteBuffer

Copyright © 2018 www.massapicom. 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.