Package org.lilyproject.bytes.impl

Examples of org.lilyproject.bytes.impl.DataOutputImpl


        return record;
    }

    public static final byte[] writeIdRecord(IdRecord record, LRepository repository)
            throws RepositoryException, InterruptedException {
        DataOutput output = new DataOutputImpl();
        writeIdRecord(record, output, repository);
        return output.toByteArray();
    }
View Full Code Here


    public void testLinkToSelf() {
        Link link = Link.newBuilder().create();
        assertNull(link.getMasterRecordId());
        assertEquals(".", link.toString());
        assertEquals(link, Link.fromString(link.toString(), idGenerator));
        DataOutput dataOutput = new DataOutputImpl();
        link.write(dataOutput);
        assertEquals(link, Link.read(new DataInputImpl(dataOutput.toByteArray()), idGenerator));


        Map<String, String> varProps = new HashMap<String, String>();
        varProps.put("lang", "en");
        varProps.put("branch", "dev");
View Full Code Here

    public void testLinkToMaster() {
        Link link = Link.newBuilder().copyAll(false).create();
        assertNull(link.getMasterRecordId());
        assertEquals(".!*", link.toString());
        assertEquals(link, Link.fromString(link.toString(), idGenerator));
        DataOutput dataOutput = new DataOutputImpl();
        link.write(dataOutput);
        assertEquals(link, Link.read(new DataInputImpl(dataOutput.toByteArray()), idGenerator));


        Map<String, String> varProps = new HashMap<String, String>();
        varProps.put("lang", "en");
        varProps.put("branch", "dev");
View Full Code Here

    }

    @Override
    public byte[] toBytes() {
        if (recordIdBytes == null) {
            DataOutput dataOutput = new DataOutputImpl();
            writeBytes(dataOutput);
            recordIdBytes = dataOutput.toByteArray();
        }
        return recordIdBytes;
    }
View Full Code Here

    }

    @Override
    public byte[] toBytes() {
        if (uuidBytes == null) {
            DataOutput dataOutput = new DataOutputImpl(17);
            writeBytes(dataOutput);
            uuidBytes = dataOutput.toByteArray();
        }
        return uuidBytes;
    }
View Full Code Here

        }
        return string;
    }

    private byte[] idToBytes(UUID uuid) {
        DataOutput dataOutput = new DataOutputImpl(16);
        dataOutput.writeLong(uuid.getMostSignificantBits());
        dataOutput.writeLong(uuid.getLeastSignificantBits());
        return dataOutput.toByteArray();
    }
View Full Code Here

        assertTrue(link.copyAll());
        assertEquals(recordId, link.getMasterRecordId());

        assertEquals("USER.123", link.toString());
        assertEquals(link, Link.fromString(link.toString(), idGenerator));
        DataOutput dataOutput = new DataOutputImpl();
        link.write(dataOutput);
        assertEquals(link, Link.read(new DataInputImpl(dataOutput.toByteArray()), idGenerator));

        RecordId ctx = idGenerator.newRecordId("0");
        RecordId resolved = link.resolve(ctx, idGenerator);
        assertEquals(recordId, resolved);
View Full Code Here

        Link link = Link.newBuilder().recordId(recordId).copyAll(false).create();
        assertEquals(masterRecordId, link.getMasterRecordId());
        assertEquals("USER.123.!*,branch=dev,lang=en", link.toString());
        assertEquals(link, Link.fromString(link.toString(), idGenerator));
        DataOutput dataOutput = new DataOutputImpl();
        link.write(dataOutput);
        assertEquals(link, Link.read(new DataInputImpl(dataOutput.toByteArray()), idGenerator));


        assertEquals(2, link.getVariantProps().size());
        assertEquals(Link.PropertyMode.SET, link.getVariantProps().get("lang").getMode());
        assertEquals("en", link.getVariantProps().get("lang").getValue());
View Full Code Here

    }

    @Override
    public byte[] toBytes() {
        if (recordIdBytes == null) {
            DataOutput dataOutput = new DataOutputImpl();
            writeBytes(dataOutput);
            recordIdBytes = dataOutput.toByteArray();
        }
        return recordIdBytes;
    }
View Full Code Here

        RecordId recordId = idGenerator.newRecordId("123");

        Link link = Link.newBuilder().recordId(recordId).remove("lang").set("x", "1").create();
        assertEquals("USER.123.-lang,x=1", link.toString());
        assertEquals(link, Link.fromString(link.toString(), idGenerator));
        DataOutput dataOutput = new DataOutputImpl();
        link.write(dataOutput);
        assertEquals(link, Link.read(new DataInputImpl(dataOutput.toByteArray()), idGenerator));


        Map<String, String> ctxVarProps = new HashMap<String, String>();
        ctxVarProps.put("lang", "en");
        ctxVarProps.put("branch", "dev");
View Full Code Here

TOP

Related Classes of org.lilyproject.bytes.impl.DataOutputImpl

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.