public Object fromStream(final ODatabaseComplex<?> iDatabase, final String iStream) {
if (iStream == null || iStream.length() == 0)
// NULL VALUE
return null;
OSerializableStream instance = null;
int propertyPos = iStream.indexOf(':');
int pos = iStream.indexOf(OStreamSerializerHelper.SEPARATOR);
if (pos < 0 || pos > propertyPos) {
instance = new ODocument((ODatabaseRecord) iDatabase);
pos = -1;
} else {
final String className = iStream.substring(0, pos);
try {
final Class<?> clazz = Class.forName(className);
instance = (OSerializableStream) clazz.newInstance();
} catch (Exception e) {
OLogManager.instance().error(this, "Error on unmarshalling content. Class: " + className, e, OSerializationException.class);
}
}
instance.fromStream(OBinaryProtocol.string2bytes(iStream.substring(pos + 1)));
return instance;
}