| Author |
Serializing a ByteArrayOutputStream
|
Mahesh Trikannad
Ranch Hand
Joined: Dec 14, 2004
Posts: 66
|
|
I have access to a ByteArrayOutputStream. The byte stream contains a PDF. I need to serialize it to send it over the network. Doing a toString() I suspect may corrupt the data. How do I serialize the byte array. Mahesh
|
Mahesh Trikannad
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24051
|
|
|
Get the data with toByteArray(), then send that. Don't bother with serialization (unless you need to, for some reason); just send the raw bytes -- it will be faster.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Mahesh Trikannad
Ranch Hand
Joined: Dec 14, 2004
Posts: 66
|
|
|
Actually I need to. The framework iam using, requires the objects I pass to be serializable
|
 |
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
|
|
|
So pass the byte array returned by toByteArray(), which is serializable like all primitive arrays.
|
"I'm not back." - Bill Harding, Twister
|
 |
Mahesh Trikannad
Ranch Hand
Joined: Dec 14, 2004
Posts: 66
|
|
|
Thanks. Guess this question belonged to the Beginner
|
 |
 |
|
|
subject: Serializing a ByteArrayOutputStream
|
|
|