Fixed up Parser edge cases in StepModel/MemoryModel identified in testing. (Was getting NRE rather than sensible exception if header could not be parsed)
MemoryModel already handled non-seekable streams - it implements a patter with a EntityFactoryDelegate which enables a single pass parse. EssentModel does not - it takes an EnityFactory as a constructore param, and this is what forces IModelProvider and IfcStore to require the XbimSchemaVersion when opening a model from a stream. Need to review if we fix that.
Fixed this by implementing a buffered stream which we use internally in IfcStore when an input stream is not Seekable. The buffer just needs to be large enough to hold the header, (typically 1-2KB). As an optimisation the buffering is disabled after we have read the header so we're not copying streaming data unnecessarily.
Fixed up Parser edge cases in StepModel/MemoryModel identified in testing. (Was getting NRE rather than sensible exception if header could not be parsed)
MemoryModel already handled non-seekable streams - it implements a patter with a EntityFactoryDelegate which enables a single pass parse. EssentModel does not - it takes an EnityFactory as a constructore param, and this is what forces IModelProvider and IfcStore to require the XbimSchemaVersion when opening a model from a stream. Need to review if we fix that.
Fixed this by implementing a buffered stream which we use internally in IfcStore when an input stream is not Seekable. The buffer just needs to be large enough to hold the header, (typically 1-2KB). As an optimisation the buffering is disabled after we have read the header so we're not copying streaming data unnecessarily.