Package com.orientechnologies.common.directmemory

Examples of com.orientechnologies.common.directmemory.ODirectMemory.allocate()


    final Random rnd = new Random();
    ODirectMemory directMemory = new OJNADirectMemory();

    long value = rnd.nextLong();

    long pointer = directMemory.allocate(OLongSerializer.LONG_SIZE);
    directMemory.setLong(pointer, value);

    Assert.assertEquals(directMemory.getLong(pointer), value);

    directMemory.free(pointer);
View Full Code Here


  public void testInt() {
    final Random rnd = new Random();
    ODirectMemory directMemory = new OJNADirectMemory();

    int value = rnd.nextInt();
    long pointer = directMemory.allocate(OIntegerSerializer.INT_SIZE);
    directMemory.setInt(pointer, value);

    Assert.assertEquals(directMemory.getInt(pointer), value);

    directMemory.free(pointer);
View Full Code Here

  public void testChar() {
    final Random rnd = new Random();
    ODirectMemory directMemory = new OJNADirectMemory();

    char value = (char) rnd.nextInt();
    long pointer = directMemory.allocate(OCharSerializer.CHAR_SIZE);
    directMemory.setChar(pointer, value);

    Assert.assertEquals(directMemory.getChar(pointer), value);

    directMemory.free(pointer);
View Full Code Here

    ODirectMemory directMemory = new OJNADirectMemory();

    byte[] value = new byte[1];
    rnd.nextBytes(value);

    long pointer = directMemory.allocate(1);
    directMemory.setByte(pointer, value[0]);

    Assert.assertEquals(directMemory.getByte(pointer), value[0]);

    directMemory.free(pointer);
View Full Code Here

    ODirectMemory directMemory = new OJNADirectMemory();

    byte[] value = new byte[256];
    rnd.nextBytes(value);

    long pointer = directMemory.allocate(value.length);
    directMemory.set(pointer, value, 0, value.length);

    Assert.assertEquals(directMemory.get(pointer, value.length), value);
    Assert.assertEquals(directMemory.get(pointer, value.length / 2), Arrays.copyOf(value, value.length / 2));
View Full Code Here

    ODirectMemory directMemory = new OJNADirectMemory();

    byte[] value = new byte[256];
    rnd.nextBytes(value);

    long pointer = directMemory.allocate(value.length);
    directMemory.set(pointer, value, value.length / 2, value.length / 2);

    Assert.assertEquals(directMemory.get(pointer, value.length / 2), Arrays.copyOfRange(value, value.length / 2, value.length));

    directMemory.free(pointer);
View Full Code Here

    ODirectMemory directMemory = new OJNADirectMemory();

    byte[] value = new byte[256];
    rnd.nextBytes(value);

    long pointer = directMemory.allocate(value.length);
    directMemory.set(pointer, value, 0, value.length);

    directMemory.moveData(pointer, pointer + value.length / 2, value.length / 2);

    System.arraycopy(value, 0, value, value.length / 2, value.length / 2);
View Full Code Here

    ODirectMemory directMemory = new OJNADirectMemory();

    byte[] value = new byte[256];
    rnd.nextBytes(value);

    long pointer = directMemory.allocate(value.length);
    directMemory.set(pointer, value, 0, value.length);

    directMemory.moveData(pointer, pointer + 1, value.length / 3);

    System.arraycopy(value, 0, value, 1, value.length / 3);
View Full Code Here

    ODirectMemory directMemory = new OJNADirectMemory();

    byte[] value = new byte[256];
    rnd.nextBytes(value);

    long pointer = directMemory.allocate(value.length);
    directMemory.set(pointer, value, 0, value.length);

    directMemory.moveData(pointer + 2, pointer + 5, value.length / 3);

    System.arraycopy(value, 2, value, 5, value.length / 3);
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.