Examples of objectToData()


Examples of com.sleepycat.bdb.bind.DataBinding.objectToData()

        Class cls = val.getClass();
        SerialFormat format = new SerialFormat(catalog, cls);
        DataBinding binding = new SerialBinding(format);
        assertSame(format, binding.getDataFormat());

        binding.objectToData(val, buffer);
        assertTrue(buffer.getDataLength() > 0);

        Object val2 = binding.dataToObject(buffer);
        assertSame(cls, val2.getClass());
        assertEquals(val, val2);
View Full Code Here

Examples of com.sleepycat.bdb.bind.DataBinding.objectToData()

        assertEquals(val, val2);

        Object valWithWrongCls = (cls == String.class)
                      ? ((Object) new Integer(0)) : ((Object) new String(""));
        try {
            binding.objectToData(valWithWrongCls, buffer);
        } catch (IllegalArgumentException expected) {}
    }

    public void testPrimitiveBindings()
        throws IOException {
View Full Code Here

Examples of com.sleepycat.bdb.bind.DataBinding.objectToData()

        Class cls = val.getClass();
        DataBinding binding = TupleBinding.getPrimitiveBinding(cls, format);
        assertSame(format, binding.getDataFormat());

        binding.objectToData(val, buffer);
        assertEquals(byteSize, buffer.getDataLength());

        Object val2 = binding.dataToObject(buffer);
        assertSame(cls, val2.getClass());
        assertEquals(val, val2);
View Full Code Here

Examples of com.sleepycat.bdb.bind.DataBinding.objectToData()

        assertEquals(val, val2);

        Object valWithWrongCls = (cls == String.class)
                      ? ((Object) new Integer(0)) : ((Object) new String(""));
        try {
            binding.objectToData(valWithWrongCls, buffer);
        }
        catch (ClassCastException expected) {}
    }

    public void testPrimitiveBindings()
View Full Code Here

Examples of com.sleepycat.bdb.bind.DataBinding.objectToData()

        DataBinding binding = new TupleInputBinding(format);
        assertSame(format, binding.getDataFormat());

        TupleOutput out = new TupleOutput();
        out.writeString("abc");
        binding.objectToData(new TupleInput(out), buffer);
        assertEquals(4, buffer.getDataLength());

        Object result = binding.dataToObject(buffer);
        assertTrue(result instanceof TupleInput);
        TupleInput in = (TupleInput) result;
View Full Code Here

Examples of com.sleepycat.bdb.bind.DataBinding.objectToData()

        DataBinding binding =
            new TupleMarshalledBinding(format, MarshalledObject.class);
        assertSame(format, binding.getDataFormat());

        MarshalledObject val = new MarshalledObject("abc", "", "", "");
        binding.objectToData(val, buffer);
        assertEquals(val.expectedDataLength(), buffer.getDataLength());

        Object result = binding.dataToObject(buffer);
        assertTrue(result instanceof MarshalledObject);
        val = (MarshalledObject) result;
View Full Code Here

Examples of com.sleepycat.bdb.bind.serial.SerialBinding.objectToData()

        Class cls = val.getClass();
        SerialFormat format = new SerialFormat(catalog, cls);
        DataBinding binding = new SerialBinding(format);
        assertSame(format, binding.getDataFormat());

        binding.objectToData(val, buffer);
        assertTrue(buffer.getDataLength() > 0);

        Object val2 = binding.dataToObject(buffer);
        assertSame(cls, val2.getClass());
        assertEquals(val, val2);
View Full Code Here

Examples of com.sleepycat.bdb.bind.serial.SerialBinding.objectToData()

        assertEquals(val, val2);

        Object valWithWrongCls = (cls == String.class)
                      ? ((Object) new Integer(0)) : ((Object) new String(""));
        try {
            binding.objectToData(valWithWrongCls, buffer);
        } catch (IllegalArgumentException expected) {}
    }

    public void testPrimitiveBindings()
        throws IOException {
View Full Code Here

Examples of com.sleepycat.bdb.bind.tuple.TupleInputBinding.objectToData()

        DataBinding binding = new TupleInputBinding(format);
        assertSame(format, binding.getDataFormat());

        TupleOutput out = new TupleOutput();
        out.writeString("abc");
        binding.objectToData(new TupleInput(out), buffer);
        assertEquals(4, buffer.getDataLength());

        Object result = binding.dataToObject(buffer);
        assertTrue(result instanceof TupleInput);
        TupleInput in = (TupleInput) result;
View Full Code Here

Examples of com.sleepycat.bdb.bind.tuple.TupleMarshalledBinding.objectToData()

        DataBinding binding =
            new TupleMarshalledBinding(format, MarshalledObject.class);
        assertSame(format, binding.getDataFormat());

        MarshalledObject val = new MarshalledObject("abc", "", "", "");
        binding.objectToData(val, buffer);
        assertEquals(val.expectedDataLength(), buffer.getDataLength());

        Object result = binding.dataToObject(buffer);
        assertTrue(result instanceof MarshalledObject);
        val = (MarshalledObject) result;
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.