Examples of TupleInput


Examples of com.sleepycat.bind.tuple.TupleInput

        TupleOutput tupleOutput = new TupleOutput();
        AMQShortStringEncoding.writeShortString(value, tupleOutput);
        byte[] data = tupleOutput.getBufferBytes();

        // read from tuple input
        TupleInput tupleInput = new TupleInput(data);
        AMQShortString result = AMQShortStringEncoding.readShortString(tupleInput);
        assertEquals("Expected " + value + " but got " + result, value, result);
    }
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleInput

        TupleOutput tupleOutput = new TupleOutput();

        _configuredObjectBinding.objectToEntry(_object, tupleOutput);

        byte[] entryAsBytes = tupleOutput.getBufferBytes();
        TupleInput tupleInput = new TupleInput(entryAsBytes);

        ConfiguredObjectRecord storedObject = _configuredObjectBinding.entryToObject(tupleInput);
        assertEquals("Unexpected attributes", DUMMY_ATTRIBUTES_STRING, storedObject.getAttributes());
        assertEquals("Unexpected type", DUMMY_TYPE_STRING, storedObject.getType());
    }
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleInput

        this.tripleComparator = newTripleComparator;
        this.tripleBinding = newTripleBinding;
    }

    public int compare(byte[] o1, byte[] o2) {
        Triple triple1 = tripleBinding.entryToObject(new TupleInput(o1));
        Triple triple2 = tripleBinding.entryToObject(new TupleInput(o2));
        return tripleComparator.compare(triple1, triple2);
    }
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleInput

                                      DatabaseEntry dataEntry,
                                      DatabaseEntry indexKeyEntry)
        throws DatabaseException {

        TupleOutput output = getTupleOutput(null);
        TupleInput primaryKeyInput = entryToInput(primaryKeyEntry);
        Object dataInput = dataBinding.entryToObject(dataEntry);
        if (createSecondaryKey(primaryKeyInput, dataInput, output)) {
            outputToEntry(output, indexKeyEntry);
            return true;
        } else {
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleInput

        throws Exception {

        to.reset();
        new Data().writeTuple(to);

        TupleInput ti = new TupleInput(
                          to.getBufferBytes(), to.getBufferOffset(),
                          to.getBufferLength());
        new Data().readTuple(ti);

        return to.getBufferLength();
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleInput

        to.writeString((String) getters[1].invoke(data, (Object[]) null));
        to.writeInt(((Integer) getters[2].invoke(data, (Object[]) null)).intValue());
        to.writeInt(((Integer) getters[3].invoke(data, (Object[]) null)).intValue());
        to.writeString((String) getters[4].invoke(data, (Object[]) null));

        TupleInput ti = new TupleInput(
                          to.getBufferBytes(), to.getBufferOffset(),
                          to.getBufferLength());
        data = new Data();
        setters[0].invoke(data, new Object[] {ti.readString()});
        setters[1].invoke(data, new Object[] {ti.readString()});
        setters[2].invoke(data, new Object[] {new Integer(ti.readInt())});
        setters[3].invoke(data, new Object[] {new Integer(ti.readInt())});
        setters[4].invoke(data, new Object[] {ti.readString()});

        return to.getBufferLength();
    }
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleInput

        to.writeString((String) fields[1].get(data));
        to.writeInt(((Integer) fields[2].get(data)).intValue());
        to.writeInt(((Integer) fields[3].get(data)).intValue());
        to.writeString((String) fields[4].get(data));

        TupleInput ti = new TupleInput(
                          to.getBufferBytes(), to.getBufferOffset(),
                          to.getBufferLength());
        data = new Data();
        fields[0].set(data, ti.readString());
        fields[1].set(data, ti.readString());
        fields[2].set(data, new Integer(ti.readInt()));
        fields[3].set(data, new Integer(ti.readInt()));
        fields[4].set(data, ti.readString());

        return to.getBufferLength();
    }
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleInput

        TupleOutput output = new TupleOutput();
        output.writeString("abc");
        val1.objectToEntry(val2, output);
        output.writeString("xyz");

        TupleInput input = new TupleInput(output);
        assertEquals("abc", input.readString());
        Object val3 = val1.entryToObject(input);
        assertEquals("xyz", input.readString());

        assertEquals(0, input.available());
        assertSame(val2.getClass(), val3.getClass());
        assertEquals(val2, val3);
    }
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleInput

        EntryBinding binding = new TupleInputBinding();

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

        Object result = binding.entryToObject(buffer);
        assertTrue(result instanceof TupleInput);
        TupleInput in = (TupleInput) result;
        assertEquals("abc", in.readString());
        assertEquals(0, in.available());
    }
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleInput

                                      DatabaseEntry dataEntry,
                                      DatabaseEntry indexKeyEntry)
        throws DatabaseException {

        TupleOutput output = getTupleOutput(null);
        TupleInput primaryKeyInput = entryToInput(primaryKeyEntry);
        Object dataInput = dataBinding.entryToObject(dataEntry);
        if (createSecondaryKey(primaryKeyInput, dataInput, output)) {
            outputToEntry(output, indexKeyEntry);
            return true;
        } else {
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.