> I am trying to build a serializable javabean.
> What can I do with inputstream? Should I always read the whole stream and
> put that into a byte[] attribute? This doesn't seem a good solution.
> What else could I do?
It depends on the role your stream plays in the bean. The main options
I see are to serialize all the stream's data with the bean (you
mentioned the easiest way to do that) or to instead serialize the data
necessary to open and position a new stream when the bean is
deserialized. The former is inelegant, and swells the serialized
representation of the bean; the latter is problematic if the required
resource is not available at deserialization time.
My recommended solution is to not make beans that contain references to
stream objects. (Bean methods may manipulate any objects to which they
are given references, however.)
John Bollinger
jobollin@indiana.edu