Example #1
0
 public ORecordId fromStream(final OMemoryStream iStream) {
   clusterId = iStream.getAsShort();
   clusterPosition =
       OClusterPositionFactory.INSTANCE.fromStream(
           iStream.getAsByteArrayFixed(OClusterPositionFactory.INSTANCE.getSerializedSize()));
   return this;
 }
Example #2
0
  protected void queryFromStream(final OMemoryStream buffer) {
    text = buffer.getAsString();
    limit = buffer.getAsInteger();

    setFetchPlan(buffer.getAsString());

    final byte[] paramBuffer = buffer.getAsByteArray();
    parameters = deserializeQueryParameters(paramBuffer);
  }
Example #3
0
  protected OMemoryStream queryToStream() {
    final OMemoryStream buffer = new OMemoryStream();

    buffer.setUtf8(text); // TEXT AS STRING
    buffer.set(limit); // LIMIT AS INTEGER
    buffer.setUtf8(
        fetchPlan != null ? fetchPlan : ""); // FETCH PLAN IN FORM OF STRING (to know more goto:
    // http://code.google.com/p/orient/wiki/FetchingStrategies)

    buffer.set(serializeQueryParameters(parameters));

    return buffer;
  }
Example #4
0
 public int toStream(final OMemoryStream iStream) throws IOException {
   final int beginOffset = OBinaryProtocol.short2bytes((short) clusterId, iStream);
   iStream.write(clusterPosition.toStream());
   return beginOffset;
 }
  public byte[] toStream() throws OSerializationException {
    final long timer = OProfiler.getInstance().startChrono();

    try {
      final OMemoryStream outStream = new OMemoryStream();
      outStream.jump(0);
      outStream.set(pageSize);

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

      outStream.set(color);
      outStream.set(size);

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

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

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

      stream.setSource(buffer);
      record.fromStream(buffer);
      return buffer;

    } catch (IOException e) {
      throw new OSerializationException("Cannot marshall RB+Tree node", e);
    } finally {
      OProfiler.getInstance().stopChrono("OMVRBTreeMapEntry.toStream", timer);
    }
  }