Examples of ReadBuffer


Examples of com.thinkaurelius.titan.diskstorage.ReadBuffer

        //Characters
        DataOutput out = serialize.getDataOutput(((int) Character.MAX_VALUE) * 2 + 8, true);
        for (char c = Character.MIN_VALUE; c < Character.MAX_VALUE; c++) {
            out.writeObjectNotNull(Character.valueOf(c));
        }
        ReadBuffer b = out.getStaticBuffer().asReadBuffer();
        for (char c = Character.MIN_VALUE; c < Character.MAX_VALUE; c++) {
            assertEquals(c, serialize.readObjectNotNull(b, Character.class).charValue());
        }


View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.ReadBuffer

        Number n = new Double(3.555);
        out.writeObjectNotNull(str);
        out.putInt(i);
        out.writeObject(c, TestClass.class);
        out.writeClassAndObject(n);
        ReadBuffer b = out.getStaticBuffer().asReadBuffer();
        if (printStats) log.debug(bufferStats(b));
        String str2 = serialize.readObjectNotNull(b, String.class);
        assertEquals(str, str2);
        if (printStats) log.debug(bufferStats(b));
        assertEquals(b.getInt(), i);
        TestClass c2 = serialize.readObject(b, TestClass.class);
        assertEquals(c, c2);
        if (printStats) log.debug(bufferStats(b));
        assertEquals(n, serialize.readClassAndObject(b));
        if (printStats) log.debug(bufferStats(b));
        assertFalse(b.hasRemaining());
    }
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.ReadBuffer

        //Characters
        DataOutput out = serialize.getDataOutput(((int) Character.MAX_VALUE) * 2 + 8, true);
        for (char c = Character.MIN_VALUE; c < Character.MAX_VALUE; c++) {
            out.writeObjectNotNull(Character.valueOf(c));
        }
        ReadBuffer b = out.getStaticBuffer().asReadBuffer();
        for (char c = Character.MIN_VALUE; c < Character.MAX_VALUE; c++) {
            assertEquals(c, serialize.readObjectNotNull(b, Character.class).charValue());
        }


View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.ReadBuffer

    public void classSerialization() {
        DataOutput out = serialize.getDataOutput(128, true);
        out.writeObjectNotNull(Boolean.class);
        out.writeObjectNotNull(Byte.class);
        out.writeObjectNotNull(Double.class);
        ReadBuffer b = out.getStaticBuffer().asReadBuffer();
        assertEquals(Boolean.class, serialize.readObjectNotNull(b, Class.class));
        assertEquals(Byte.class, serialize.readObjectNotNull(b, Class.class));
        assertEquals(Double.class, serialize.readObjectNotNull(b, Class.class));
    }
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.ReadBuffer

        for (int i = 0; i < numThreads; i++) {
            threads[i] = new Thread(new Runnable() {
                @Override
                public void run() {
                    for (int j = 0; j < 100000; j++) {
                        ReadBuffer c = b.asReadBuffer();
                        assertEquals(8, c.getLong());
                        Long l = (Long) serialize.readClassAndObject(c);
                        assertEquals(8, l.longValue());
                        TestClass c2 = serialize.readObjectNotNull(c, TestClass.class);
                    }
                }
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.ReadBuffer

        out.writeObjectNotNull(new Float((float) 0.0));
        out.writeObjectNotNull(DoubleSerializer.MIN_VALUE);
        out.writeObjectNotNull(DoubleSerializer.MAX_VALUE);
        out.writeObjectNotNull(new Double(0.0));

        ReadBuffer b = out.getStaticBuffer().asReadBuffer();
        assertEquals(Boolean.FALSE, serialize.readObjectNotNull(b, Boolean.class));
        assertEquals(Boolean.TRUE, serialize.readObjectNotNull(b, Boolean.class));
        assertEquals(Byte.MIN_VALUE, serialize.readObjectNotNull(b, Byte.class).longValue());
        assertEquals(Byte.MAX_VALUE, serialize.readObjectNotNull(b, Byte.class).longValue());
        assertEquals(0, serialize.readObjectNotNull(b, Byte.class).longValue());
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.ReadBuffer

        DataOutput out = serialize.getDataOutput(128, true);
        for (int i = 0; i < no; i++) {
            String str = base + (i + 1);
            out.writeObjectNotNull(str);
        }
        ReadBuffer b = out.getStaticBuffer().asReadBuffer();
        if (printStats) log.debug(bufferStats(b));
        for (int i = 0; i < no; i++) {
            String str = base + (i + 1);
            String read = serialize.readObjectNotNull(b, String.class);
            assertEquals(str, read);
        }
        assertFalse(b.hasRemaining());
    }
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.ReadBuffer

        String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //26 chars
        String str = "";
        for (int i = 0; i < 100; i++) str += base;
        DataOutput out = serialize.getDataOutput(128, true);
        out.writeObjectNotNull(str);
        ReadBuffer b = out.getStaticBuffer().asReadBuffer();
        if (printStats) log.debug(bufferStats(b));
        assertEquals(str, serialize.readObjectNotNull(b, String.class));
        assertFalse(b.hasRemaining());
    }
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.ReadBuffer

    @Test
    public void enumSerializeTest() {
        DataOutput out = serialize.getDataOutput(128, true);
        out.writeObjectNotNull(TestEnum.Two);
        ReadBuffer b = out.getStaticBuffer().asReadBuffer();
        if (printStats) log.debug(bufferStats(b));
        assertEquals(TestEnum.Two, serialize.readObjectNotNull(b, TestEnum.class));
        assertFalse(b.hasRemaining());

    }
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.ReadBuffer

    }

    private RelationCache parseRelation(long vertexid, Entry data, boolean parseHeaderOnly, StandardTitanTx tx) {
        assert vertexid > 0;

        ReadBuffer column = data.getReadColumn();
        ReadBuffer value = data.getReadValue();

        LongObjectOpenHashMap properties = parseHeaderOnly ? null : new LongObjectOpenHashMap(4);
        long[] typeAndDir = IDHandler.readEdgeType(column);
        int dirID = (int) typeAndDir[1];
        long typeId = typeAndDir[0];

        Direction dir;
        RelationType rtype;
        switch (dirID) {
            case PROPERTY_DIR:
                dir = Direction.OUT;
                rtype = RelationType.PROPERTY;
                break;

            case EDGE_OUT_DIR:
                dir = Direction.OUT;
                rtype = RelationType.EDGE;
                break;

            case EDGE_IN_DIR:
                dir = Direction.IN;
                rtype = RelationType.EDGE;
                break;

            default:
                throw new IllegalArgumentException("Invalid dirID read from disk: " + dirID);
        }

        TitanType titanType = tx.getExistingType(typeId);

        InternalType def = (InternalType) titanType;
        long[] keysig = def.getSortKey();
        if (!parseHeaderOnly && !titanType.isUnique(dir)) {
            ReadBuffer sortKeyReader = def.getSortOrder()==Order.DESC?column.invert():column;
            readInlineTypes(keysig, properties, sortKeyReader, tx);
        }

        long relationIdDiff, vertexIdDiff = 0;
        if (titanType.isUnique(dir)) {
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.