File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes Object output stream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Object output stream" Watch "Object output stream" New topic

Object output stream

vibeeshan kambli
Ranch Hand

Joined: Jan 22, 2003
Posts: 41
I need your advise on serialization.
I need to send stream to my server which one is efficient

Method 1:
1. read the object
2. convert the object using xstream in to xml string
3. convert to bytes and write to servlet output stream
4. read the bytes and convert bytes to xml string
5. convert xml string back to object

Method 2:-

1. read the object
2. convert to bytes using object output stream and write to servlet output stream
4. read the bytes and convert back to object using object input stream

my question is which is efficient ?
using method 1 and method 2 ?
by looking at the steps , one could argue that method 1 having xml over head
am I right? or using object output stream is more over head ( method 2 ) ?

my result set could be (comes back from servlet) could be several thousands be records
Any help is greatly appreciated
I agree. Here's the link:
subject: Object output stream
It's not a secret anymore!