[vtk-developers] XML readers/writers with user streams
goodwin.lawlor at ucd.ie
Fri Jun 29 10:40:40 EDT 2007
> Goodwin Lawlor wrote:
> > Reading through vtkXMLWriter/vtkXMLReader its looks like they
> were coded
> > to allow the reading and writing of datasets to/from a user stream
> > instead of to/from disk.
> > Was there any method to do this envisioned originally?
> Yes, but there is no official support for this currently. It was
> briefly investigated when the writers/readers were first written. The
> problem was that some string stream implementations seem to
> truncate the
> stream if one seeks back to overwrite a few bytes. The default
> AppendedData mode breaks with this behavior. If you use
> SetDataModeToBinary it may work because the data will be written
> inlineas base64-encoded data so no seeks will occur (I think).
> IIRC, only small changes to the interface are needed to enable
> using a
> string stream. I cannot remember whether there were other problems
It seems to be working for me ok... but I haven't tested it extensively.
I did hit a problem with "Stream->seekp(0)" in vtkXMLWriter - it causes
the failbit to be set... this is a "feature" apparently:
. Using "Stream->clear()" sorts it out though.
Also, "this->DataStream->SetStream(0);" had to moved into the "if" block
If anyone is interested I'll put the vtkStringStream class and the
patches to vtkXMLWriter/vtkXMLReader up on the bug tracker as an idea.
More information about the vtk-developers