Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Newbie serialization question  RSS feed

 
ravinderSingh singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I make an java.io.InputStream serializable so that it can be stored in a file or passed as a parameter in a remote method call?
 
Steffen Reinhard
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why should you want to do such a thing as serializing a java.io.InputStream? Maybe I'm making a public display of ignorance but what's the use of serializing an abstract class when there's no object to recover via deserialization?

I gather you want to do some basic networking, so I think you need to create a java.net.Socket object and derive your InputStream from it (using Socket's getInputStream()-method). The Socket class itself isn#t serializable but if need be you can create a serializable class encapsulating the necessary fields to create the socket.

I'm not too familiar with RMI but as far as I know, RMI is somewhat more enhanced in terms of networking functionality so the odds are pretty good you can do whatever networking tasks you have to do without having to fiddle about with low-level networking techniques such as Sockets or InputStreams.

Cheers -

Steffen
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!