[vtk-developers] reading and writing to non-files

Brad King brad.king at kitware.com
Wed Dec 15 13:17:54 EST 2004


Michael Halle wrote:
> We've been investigating reading and writing VTK
> data files from non-file sources (network connections,
> databases, etc).  vtkDataReader and DataWriter now seem
> to support IO from/to strings and client-controlled
> character arrays as well as using SetFileName().
> Reading everything from a single string isn't ideal;
> I'd prefer to have a method called "FeedData()" that
> I could give smaller chunks of data to a reader, but
> at least the string methods allow some flexibility.
> 
> On the other hand, the newer XML readers don't seem
> to have that functionality (they don't subclass the
> DataReaders and DataWriters, and they don't implement it
> natively).  The Image IO classes don't seem to allow
> non-file access either.

The XML writers could easily be modified to write to strings except that 
string streams do not support random access in the way the XML writers 
need.  When one does "seekp" on a string stream to go back from the 
current position and start wrting, the rest of the string is destroyed 
rather than overwritten.

We do have plans to support streaming data over network sockets using 
the XML writers but this support is not high priority right now.

-Brad



More information about the vtk-developers mailing list