/// <exception cref="System.IO.IOException"/> public virtual TPortable ReadPortable <TPortable>(string fieldName) where TPortable : IPortable { var currentPos = _in.Position(); try { var fd = Cd.GetField(fieldName); if (fd == null) { throw ThrowUnknownFieldException(fieldName); } if (fd.GetFieldType() != FieldType.Portable) { throw new HazelcastSerializationException("Not a Portable field: " + fieldName); } var pos = ReadPosition(fd); _in.Position(pos); var isNull = _in.ReadBoolean(); var factoryId = _in.ReadInt(); var classId = _in.ReadInt(); CheckFactoryAndClass(fd, factoryId, classId); if (!isNull) { return((TPortable)Serializer.ReadAndInitialize(_in, factoryId, classId)); } return(default(TPortable)); } finally { _in.Position(currentPos); } }
/// <exception cref="System.IO.IOException"/> public virtual P ReadPortable <P>(string fieldName) where P : IPortable { int currentPos = @in.Position(); try { IFieldDefinition fd = cd.GetField(fieldName); if (fd == null) { throw ThrowUnknownFieldException(fieldName); } if (fd.GetFieldType() != FieldType.Portable) { throw new HazelcastSerializationException("Not a Portable field: " + fieldName); } int pos = ReadPosition(fd); @in.Position(pos); bool isNull = @in.ReadBoolean(); int factoryId = @in.ReadInt(); int classId = @in.ReadInt(); CheckFactoryAndClass(fd, factoryId, classId); if (!isNull) { return((P)serializer.ReadAndInitialize(@in, factoryId, classId)); } return(default(P)); } finally { @in.Position(currentPos); } }