IBStream and std::stream

In my getState() function, I want to use XML-formatted chunk data. However, the XML parser expects a std::stream (istream or stringstream) for the data, and what I am given is an IBStream*. Is there an easy way to get the data, whose size I do not know in advance, from the IBStream* into a std::stream?

Looks like I can to a tell() on the stream to get the start position, then seek to the end and do another tell(), and subtract to get the length, then rewind back to the start position. Then I can load the data into a stringstream and pass that to my library for parsing.