posted 14 years ago
The short answer is, because no OutputStream (that I know of) implements the Serializable interface. Therefore, if you try to serialize it, you will get an exception. They didn't design these classes to be serializable because they didn't think it would be useful to anyone.
I think you probably need to serialize the data written to the OutputStream. Can you tell us anything about the OutputStream you're using? Where did it come from? Did you create it, or did it come from some other class? What sort of data is being written to it?
One possibly useful technique is to us a ByteArrayOutputStream for the OutputStream. When you are done writing to the stream, close() it, and then call toByteArray(). Now you have a byte[] which can be serialized.
"I'm not back." - Bill Harding, Twister