Package com.sleepycat.bind.tuple

Examples of com.sleepycat.bind.tuple.TupleOutput


    void storeVirtualHostHierarchyRecord(Database hierarchyDb, Transaction txn, UUID id, UUID virtualHostId)
    {
        DatabaseEntry key = new DatabaseEntry();
        DatabaseEntry value = new DatabaseEntry();
        UUIDTupleBinding.getInstance().objectToEntry(virtualHostId, value);
        TupleOutput tupleOutput = new TupleOutput();
        tupleOutput.writeLong(id.getMostSignificantBits());
        tupleOutput.writeLong(id.getLeastSignificantBits());
        tupleOutput.writeString("VirtualHost");
        TupleBinding.outputToEntry(tupleOutput, key);
        hierarchyDb.put(txn, key, value);
    }
View Full Code Here


                AMQShortString queueNameAMQ = new AMQShortString(queueName);
                QueueRecord record = new QueueRecord(queueNameAMQ, null, false, null);

                DatabaseEntry key = new DatabaseEntry();

                TupleOutput output = new TupleOutput();
                AMQShortStringEncoding.writeShortString(record.getNameShortString(), output);
                TupleBase.outputToEntry(output, key);

                DatabaseEntry newValue = new DatabaseEntry();
                binding.objectToEntry(record, newValue);
View Full Code Here

                DUMMY_ATTRIBUTES_MAP);
    }

    public void testObjectToEntryAndEntryToObject()
    {
        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_MAP, storedObject.getAttributes());
        assertEquals("Unexpected type", DUMMY_TYPE_STRING, storedObject.getType());
View Full Code Here

     * @param object the object being serialized
     * @return the hex string containing the serialized hex form of the object
     */
    static <T> String objectToHex(TupleBinding<T> binding, T object) {
        StringBuffer buffer = new StringBuffer();
        TupleOutput tuple = new TupleOutput(new byte[100]);
        binding.objectToEntry(object, tuple);
        byte[] bytes = tuple.getBufferBytes();
        int size = tuple.getBufferLength();

        for (int i=0; i < size; i++) {
            int lowNibble = (bytes[i] & 0xf);
            int highNibble = ((bytes[i]>>4) & 0xf);
            buffer.append(Character.forDigit(lowNibble,16));
View Full Code Here

     *
     * @return the serailized byte array
     */
    static public byte[] serializeBytes(RepNodeImpl node) {
        final NodeBinding binding = new NodeBinding();
        TupleOutput tuple = new TupleOutput(new byte[100]);
        binding.objectToEntry(node, tuple);
        return tuple.getBufferBytes();
    }
View Full Code Here

    public boolean createSecondaryKey(SecondaryDatabase secDb, DatabaseEntry keyEntry, DatabaseEntry valueEntry,
            DatabaseEntry resultEntry) throws DatabaseException {
        KeyValue kv = KeyValue.class.cast(keyBinding.entryToObject(keyEntry));
        long timestamp = kv.getTimestamp();
       
        TupleOutput to = new TupleOutput();
        to.writeLong(timestamp);
        resultEntry.setData(to.getBufferBytes());
        return true;
    }
View Full Code Here

    public boolean createSecondaryKey(SecondaryDatabase secDb, DatabaseEntry keyEntry, DatabaseEntry valueEntry,
            DatabaseEntry resultEntry) throws DatabaseException {
        KeyValue kv = KeyValue.class.cast(keyBinding.entryToObject(keyEntry));
        String feedID = kv.getFeedID();
       
        TupleOutput to = new TupleOutput();
        to.writeString(feedID);
        resultEntry.setData(to.getBufferBytes());
        return true;
    }
View Full Code Here

    * parts.
    */
   private DatabaseEntry makeKeyEntry(Fqn name, int nParts) {

      /* Write the sequence of name parts. */
      TupleOutput tupleOutput = new TupleOutput();
      for (int i = 0; i < nParts; i += 1) {
         tupleOutput.writeString(name.get(i).toString());
      }

      /* Return the tuple as an entry. */
      DatabaseEntry entry = new DatabaseEntry();
      TupleBinding.outputToEntry(tupleOutput, entry);
View Full Code Here

    * a child name part.
    */
   private DatabaseEntry makeKeyEntry(DatabaseEntry prefix, String namePart) {

      /* Write the bytes of the prefix followed by the child name. */
      TupleOutput tupleOutput = new TupleOutput();
      tupleOutput.writeFast(prefix.getData(),
                            prefix.getOffset(),
                            prefix.getSize());
      tupleOutput.writeString(namePart);

      /* Return the tuple as an entry. */
      DatabaseEntry entry = new DatabaseEntry();
      TupleBinding.outputToEntry(tupleOutput, entry);
      return entry;
View Full Code Here

    * parts.
    */
   private DatabaseEntry makeKeyEntry(Fqn name, int nParts)
   {
      /* Write the sequence of name parts. */
      TupleOutput tupleOutput = new TupleOutput();
      for (int i = 0; i < nParts; i += 1)
      {
         tupleOutput.writeString(name.get(i).toString());
      }

      /* Return the tuple as an entry. */
      DatabaseEntry entry = new DatabaseEntry();
      TupleBinding.outputToEntry(tupleOutput, entry);
View Full Code Here

TOP

Related Classes of com.sleepycat.bind.tuple.TupleOutput

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.