Examples of OMemoryOutputStream


Examples of com.orientechnologies.orient.core.serialization.OMemoryOutputStream

    record = new ORecordBytesLazy(this);

    keySerializer = iKeySerializer;
    valueSerializer = iValueSerializer;

    entryRecordBuffer = new OMemoryOutputStream(getPageSize() * 15);

    setListener(this);
  }
 
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryOutputStream

      // ALREADY IN STACK, RETURN EMPTY
      return new byte[] {};
    } else
      marshalledRecords.add(identityRecord);

    OMemoryOutputStream stream = entryRecordBuffer;

    try {
      stream.add(CURRENT_PROTOCOL_VERSION);

      if (root != null) {
        OMVRBTreeEntryPersistent<K, V> pRoot = (OMVRBTreeEntryPersistent<K, V>) root;
        if (pRoot.record.getIdentity().isNew()) {
          // FIRST TIME: SAVE IT
          pRoot.save();
        }

        stream.addAsFixed(pRoot.record.getIdentity().toStream());
      } else
        stream.addAsFixed(ORecordId.EMPTY_RECORD_ID_STREAM);

      stream.add(size);
      stream.add(lastPageSize);

      stream.add(keySerializer.getName());
      stream.add(valueSerializer.getName());

      record.fromStream(stream.getByteArray());
      return record.toStream();

    } catch (IOException e) {
      throw new OSerializationException("Error on marshalling RB+Tree", e);
    } finally {
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryOutputStream

      record.setDirty();
    }

    final long timer = OProfiler.getInstance().startChrono();

    final OMemoryOutputStream outStream = new OMemoryOutputStream();

    try {
      outStream.add(pageSize);

      outStream.addAsFixed(parentRid.toStream());
      outStream.addAsFixed(leftRid.toStream());
      outStream.addAsFixed(rightRid.toStream());

      outStream.add(color);
      outStream.add(size);

      for (int i = 0; i < size; ++i)
        serializedKeys[i] = outStream.add(serializeNewKey(i));

      for (int i = 0; i < size; ++i)
        serializedValues[i] = outStream.add(serializeNewValue(i));

      outStream.flush();

      final byte[] buffer = outStream.getByteArray();

      inStream.setSource(buffer);

      record.fromStream(buffer);
      return buffer;
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryOutputStream

      record.setDirty();
    }

    final long timer = OProfiler.getInstance().startChrono();

    final OMemoryOutputStream outStream = new OMemoryOutputStream();

    try {
      outStream.add(pageSize);

      outStream.addAsFixed(parentRid.toStream());
      outStream.addAsFixed(leftRid.toStream());
      outStream.addAsFixed(rightRid.toStream());

      outStream.add(color);
      outStream.add(size);

      for (int i = 0; i < size; ++i)
        serializedKeys[i] = outStream.add(serializeNewKey(i));

      for (int i = 0; i < size; ++i)
        serializedValues[i] = outStream.add(serializeNewValue(i));

      outStream.flush();

      final byte[] buffer = outStream.getByteArray();

      inStream.setSource(buffer);

      record.fromStream(buffer);
      return buffer;
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryOutputStream

    }
    return this;
  }

  public byte[] toStream() throws OSerializationException {
    final OMemoryOutputStream buffer = new OMemoryOutputStream();
    try {
      buffer.add(text);

      if (parameters == null || parameters.size() == 0)
        buffer.add(new byte[0]);
      else {
        final ODocument param = new ODocument(database);
        param.field("params", parameters);
        buffer.add(param.toStream());
      }

    } catch (IOException e) {
      throw new OSerializationException("Error while marshalling OCommandRequestTextAbstract impl", e);
    }

    return buffer.toByteArray();
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryOutputStream

      record.setDirty();
    }

    final long timer = OProfiler.getInstance().startChrono();

    final OMemoryOutputStream outStream = new OMemoryOutputStream();

    try {
      outStream.add(pageSize);

      outStream.addAsFixed(parentRid.toStream());
      outStream.addAsFixed(leftRid.toStream());
      outStream.addAsFixed(rightRid.toStream());

      outStream.add(color);
      outStream.add(size);

      for (int i = 0; i < size; ++i)
        serializedKeys[i] = outStream.add(serializeNewKey(i));

      for (int i = 0; i < size; ++i)
        serializedValues[i] = outStream.add(serializeNewValue(i));

      outStream.flush();

      final byte[] buffer = outStream.getByteArray();

      inStream.setSource(buffer);

      record.fromStream(buffer);
      return buffer;
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryOutputStream

    }
    return this;
  }

  public byte[] toStream() throws OSerializationException {
    final OMemoryOutputStream buffer = new OMemoryOutputStream();
    try {
      buffer.add(text); // TEXT AS STRING
      buffer.add(limit); // LIMIT AS INTEGER
      buffer.addAsFixed(beginRange.toStream()); // THE RID WHERE TO BEGIN, OR -1:-1 to ignore it
      buffer.addAsFixed(endRange.toStream()); // THE RID WHERE TO END, OR -1:-1 to ignore it
      buffer.add(fetchPlan != null ? fetchPlan : ""); // FETCH PLAN IN FORM OF STRING (to know more goto:
                                                      // http://code.google.com/p/orient/wiki/FetchingStrategies)

      if (parameters == null || parameters.size() == 0)
        // NO PARAMETER, JUST SEND 0
        buffer.add(new byte[0]);
      else {
        // PARAMETERS FOUND, SEND THEM AS DOCUMENT ITSELF
        final ODocument param = new ODocument();
        param.field("params", parameters);
        buffer.add(param.toStream());
      }

    } catch (IOException e) {
      throw new OSerializationException("Error while marshalling OSQLQuery", e);
    }

    return buffer.toByteArray();
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryOutputStream

    record = new ORecordBytesLazy(this);

    keySerializer = iKeySerializer;
    valueSerializer = iValueSerializer;

    entryRecordBuffer = new OMemoryOutputStream(getPageSize() * 15);

    setListener(this);
  }
 
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryOutputStream

      // ALREADY IN STACK, RETURN EMPTY
      return new byte[] {};
    } else
      marshalledRecords.add(identityRecord);

    OMemoryOutputStream stream = entryRecordBuffer;

    try {
      stream.add(CURRENT_PROTOCOL_VERSION);

      if (root != null) {
        OMVRBTreeEntryPersistent<K, V> pRoot = (OMVRBTreeEntryPersistent<K, V>) root;
        if (pRoot.record.getIdentity().isNew()) {
          // FIRST TIME: SAVE IT
          pRoot.save();
        }

        stream.addAsFixed(pRoot.record.getIdentity().toStream());
      } else
        stream.addAsFixed(ORecordId.EMPTY_RECORD_ID_STREAM);

      stream.add(size);
      stream.add(lastPageSize);

      stream.add(keySerializer.getName());
      stream.add(valueSerializer.getName());

      record.fromStream(stream.getByteArray());
      return record.toStream();

    } catch (IOException e) {
      throw new OSerializationException("Error on marshalling RB+Tree", e);
    } finally {
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryOutputStream

    }
    return this;
  }

  public byte[] toStream() throws OSerializationException {
    final OMemoryOutputStream buffer = new OMemoryOutputStream();
    try {
      buffer.add(text);

      if (parameters == null || parameters.size() == 0)
        buffer.add(new byte[0]);
      else {
        final ODocument param = new ODocument(database);
        param.field("params", parameters);
        buffer.add(param.toStream());
      }

    } catch (IOException e) {
      throw new OSerializationException("Error while marshalling OCommandRequestTextAbstract impl", e);
    }

    return buffer.toByteArray();
  }
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.