views:

99

answers:

2

I have code that generates a data-driven SVG graph and I'd like to display the graph directly. The method:

javax.microedition.m2g.ScalableImage.createImage

can take either a URI or an InputStream as the source data for the graph, what would be a good way to pass my graph data in? It's in String form in memory, so from what I can see I can either create a custom class extending InputStream (would prefer not to), or write the SVG data to disk and have it read back in. Is there any better ways of doing this?

+1  A: 

It looks like this will do you what you want:

http://stackoverflow.com/questions/247161/how-do-i-turn-a-string-into-a-stream-in-java

I don't know if that will apply on BlackBerry though.

mathepic
A: 

A ByteArrayInputStream constructed with myStringData.getBytes() looks like a nice solution -- thanks.

HughOBrien
This is a comment, or maybe an edit to the question, there's little point in repeating the best answer yourself.
unwind