« [Tip] Web client connection troubleshooting | Main | [Article] Integrate Google Maps into your Servoy solution »
January 26, 2007
[Tip] Blob to string
by Karel Broer
Free Colours
Wouldn't it be great to get the (string) content of a binary file that is saved in a blob without creating a temp file first? It is possible!
For example: RTF document is saved in 'media_field_rtf'.
Get the content of the rtf in a var:
var text = ''
text = new java.lang.String(media_field_rtf)
You can do the same with every binary file in a blob; think about what you can do now with .XML, .HTML or .TEXT files!
| Posted by David Workman on January 26, 2007 at 10:31 AM in Tips | Permalink
Comments
Cool tip, Karel!
Thanks.
Posted by: Harjo Kompagnie | Jan 26, 2007 1:32:14 PM
Yea, this tip rocks Karel. Worth a beer...maybe two beers...
Posted by: David Workman | Jan 26, 2007 6:13:55 PM
Be careful not to create String objects of large binaries. Maybe it would be better to stream this stuff out to disk ?
Posted by: John Sanderson | Jan 27, 2007 5:42:46 PM