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

Michael Halle mhalle at bwh.harvard.edu
Wed Dec 15 13:30:45 EST 2004


On Dec 15, 2004, at 1:17 PM, Brad King wrote:

> 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.

What about readers?  I would think that reading from a
string would be somewhere more used than writing
(use case:  reading from an HTTP or FTP connection,
but not needing to write back to it).   A reader's
data bounds are also known ahead of time.

--Mike




More information about the vtk-developers mailing list