wood burning stoves 2.0*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
It is sorta covered in the JavaRanch Style Guide.
subject: Object output stream
Similar Threads
Most direct way of going from an Object to a XML String using JAXB?
Error : Processing Instruction Target
Understanding Byte Data and Character Encoding
I/O Wrappers