I need to write a combination of String and Images to a file.

The catch is that I have to write some String, then the Image, then more String again.

Does anyone have any ideas how to do this?

Should I use BufferedImage?

Recommended Answers

All 2 Replies

This is definitely interesting. Before I get into my crazy idea of how to do this (that involves bit stuffing and using a special character to denote the start and end of images) let me make sure I understand the issues. Mixing images and text is never really done in the same file, and I don't think there are any 'standard' ways to do this. Do you plan to read back in the images and Strings properly later? Because if you just start writing them to a file together how will you know which is which? You need some way to denote where an image starts and ends. I hardly think writing both to the same file is your issue - being able to read them back in correctly later is your real problem. Yes/no? And any other more intelligent members here have any suggestions? (Before I go off on a tangent about bit stuffing, because there is probably a much easier way to do this?)

Well, you nailed the issues right on the head :)

Go ahead and explain. If I'm ont able to use it, no worries!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.