Package com.tangosol.util

Examples of com.tangosol.util.Binary


    private Object extractInternal(Entry entry, int target) {
        if (entry instanceof BinaryEntry) {
            BinaryEntry be = (BinaryEntry) entry;
            if (be.getSerializer() instanceof PofContext) {
                PofContext ctx = (PofContext) be.getSerializer();
                Binary bt;
                if (target == AbstractExtractor.KEY) {
                    bt = be.getBinaryKey();
                }
                else if (target == AbstractExtractor.VALUE) {
                    bt = be.getBinaryValue();
View Full Code Here


        store((Object)binKey, (Object)binValue);       
    }

    @Override
    protected Object keyFromBytes(byte[] data, int offs, int size) {
        return new Binary(data, offs, size);
    }
View Full Code Here

        return new Binary(data, offs, size);
    }

    @Override
    protected Object valueFromBytes(byte[] data, int offs, int size) {
        return new Binary(data, offs, size);
    }
View Full Code Here

    @Test
    public void testTypeA() {
        ConfigurablePofContext ctx = new ConfigurablePofContext(XmlHelper.loadXml(getClass().getResource("/test-pof-config.xml")));
       
        Binary blob = ExternalizableHelper.toBinary(new TypeA(), ctx);
        PofValue root = PofValueParser.parse(blob, ctx);
   
        Assert.assertTrue(root instanceof ComplexPofValue);
       
        ComplexPofValue cf = (ComplexPofValue) root;
View Full Code Here

        ConfigurablePofContext ctx = new ConfigurablePofContext(XmlHelper.loadXml(getClass().getResource("/test-pof-config.xml")));
       
        TypeB b = new TypeB();
        b.string = "ABC";
       
        Binary blob = ExternalizableHelper.toBinary(b, ctx);
       
        ReflectionPofExtractor extracter1 = new ReflectionPofExtractor("string");
        Assert.assertEquals("ABC", extracter1.extractFromBinary(ctx, blob));       
    }
View Full Code Here

        ConfigurablePofContext ctx = new ConfigurablePofContext(XmlHelper.loadXml(getClass().getResource("/test-pof-config.xml")));
       
        TypeB b = new TypeB();
        b.string = "ABC";
       
        Binary blob = ExternalizableHelper.toBinary(b, ctx);
       
        ReflectionPofExtractor extracter = new ReflectionPofExtractor("string.count");
       
        Assert.assertEquals(3, extracter.extractFromBinary(ctx, blob));       
    }
View Full Code Here

        ConfigurablePofContext ctx = new ConfigurablePofContext(XmlHelper.loadXml(getClass().getResource("/test-pof-config.xml")));
       
        TypeB b = new TypeB();
        b.string = null;
       
        Binary blob = ExternalizableHelper.toBinary(b, ctx);
       
        ReflectionPofExtractor extracter = new ReflectionPofExtractor("string");
       
        Assert.assertEquals(null, extracter.extractFromBinary(ctx, blob));       
    }
View Full Code Here

        ConfigurablePofContext ctx = new ConfigurablePofContext(XmlHelper.loadXml(getClass().getResource("/test-pof-config.xml")));
       
        TypeB b = new TypeB();
        b.tu = TimeUnit.MILLISECONDS;
       
        Binary blob = ExternalizableHelper.toBinary(b, ctx);
       
        ReflectionPofExtractor extracter = new ReflectionPofExtractor("tu");
       
        Assert.assertEquals(TimeUnit.MILLISECONDS, extracter.extractFromBinary(ctx, blob));       
    }
View Full Code Here

        ConfigurablePofContext ctx = new ConfigurablePofContext(XmlHelper.loadXml(getClass().getResource("/test-pof-config.xml")));
       
        TypeB b = new TypeB();
        b.tu = null;
       
        Binary blob = ExternalizableHelper.toBinary(b, ctx);
       
        ReflectionPofExtractor extracter = new ReflectionPofExtractor("tu");
       
        Assert.assertEquals(null, extracter.extractFromBinary(ctx, blob));       
    }
View Full Code Here

        ConfigurablePofContext ctx = new ConfigurablePofContext(XmlHelper.loadXml(getClass().getResource("/test-pof-config.xml")));
       
        TypeB b = new TypeB();
        b.stringArray = new String[]{"A","B","C"};
       
        Binary blob = ExternalizableHelper.toBinary(b, ctx);
       
        ReflectionPofExtractor extracter;
        extracter = new ReflectionPofExtractor("stringArray");       
        Assert.assertArrayEquals(new String[]{"A","B","C"}, (String[])extracter.extractFromBinary(ctx, blob));       
View Full Code Here

TOP

Related Classes of com.tangosol.util.Binary

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.