core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerSBTreeIndexRIDContainer.java
@Override
  public OIndexRIDContainer deserializeFromByteBufferObject(ByteBuffer buffer, OWALChanges walChanges, int offset) {
    final long fileId = walChanges.getLongValue(buffer, offset + FILE_ID_OFFSET);
    final boolean durable = walChanges.getByteValue(buffer, offset + DURABLE_OFFSET) > 0;

    if (walChanges.getByteValue(buffer, offset + EMBEDDED_OFFSET) > 0) {
      final int size = walChanges.getIntValue(buffer, offset + EMBEDDED_SIZE_OFFSET);
      final Set<OIdentifiable> underlying = new HashSet<OIdentifiable>(Math.max((int) (size / .75f) + 1, 16));

      int p = offset + EMBEDDED_VALUES_OFFSET;
      for (int i = 0; i < size; i++) {
        underlying.add(LINK_SERIALIZER.deserializeFromByteBufferObject(buffer, walChanges, p));
        p += RID_SIZE;
      }

      return new OIndexRIDContainer(fileId, underlying, durable);
    } else {
      final long pageIndex = walChanges.getLongValue(buffer, offset + SBTREE_ROOTINDEX_OFFSET);
      final int pageOffset = walChanges.getIntValue(buffer, offset + SBTREE_ROOTOFFSET_OFFSET);
      final OBonsaiBucketPointer rootPointer = new OBonsaiBucketPointer(pageIndex, pageOffset);
      final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.instance().get();
      final OIndexRIDContainerSBTree underlying = new OIndexRIDContainerSBTree(fileId, rootPointer,
          (OAbstractPaginatedStorage) db.getStorage().getUnderlying());
      return new OIndexRIDContainer(fileId, underlying, durable);
    }
  }
@Override
  public OIndexRIDContainer deserializeFromByteBufferObject(ByteBuffer buffer, OWALChanges walChanges, int offset) {
    final long fileId = walChanges.getLongValue(buffer, offset + FILE_ID_OFFSET);
    final boolean durable = walChanges.getByteValue(buffer, offset + DURABLE_OFFSET) > 0;

    if (walChanges.getByteValue(buffer, offset + EMBEDDED_OFFSET) > 0) {
      final int size = walChanges.getIntValue(buffer, offset + EMBEDDED_SIZE_OFFSET);
      final Set<OIdentifiable> underlying = new HashSet<OIdentifiable>(Math.max((int) (size / .75f) + 1, 16));

      int p = offset + EMBEDDED_VALUES_OFFSET;
      for (int i = 0; i < size; i++) {
        underlying.add(LINK_SERIALIZER.deserializeFromByteBufferObject(buffer, walChanges, p));
        p += RID_SIZE;
      }

      return new OIndexRIDContainer(fileId, underlying, durable);
    } else {
      final long pageIndex = walChanges.getLongValue(buffer, offset + SBTREE_ROOTINDEX_OFFSET);
      final int pageOffset = walChanges.getIntValue(buffer, offset + SBTREE_ROOTOFFSET_OFFSET);
      final OBonsaiBucketPointer rootPointer = new OBonsaiBucketPointer(pageIndex, pageOffset);
      final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.instance().get();
      final OIndexRIDContainerSBTree underlying = new OIndexRIDContainerSBTree(fileId, rootPointer,
          (OAbstractPaginatedStorage) db.getStorage().getUnderlying());
      return new OIndexRIDContainer(fileId, underlying, durable);
    }
  }
{@inheritDoc}