Judge a man by his questions rather than his answers --Voltaire
SCJP 1.5 97%
So, it does not make sense to return them from a remote method. This is the reason why these classes do not implement Serializable and hence can not be serialized.
apigee, a better way to API!
Now serializing streams is a very different matter. The whole point of a stream is that you're taking data and either writing or reading it as a sequence of bytes - thus, the data is already being serialized. That's what serialization is, the process of converting objects to and from a sequence of bytes. If the data is already expressed as a sequence of bytes, there's nothing to do - it's pointless.
Attempting to serialize a stream is also kind of like attempting to send a telephone through your telephone. You use the telephone to send messages, data. You don't use it to send other telephones; that makes no sense. You might want to transmit information like a telephone number, that someone else can then use to initiate their own telephone call. But the other person you tell the number to still needs to use their own telephone and dial the number themselves; you can't send them a phone over the phone so they can use it.
"I'm not back." - Bill Harding, Twister
Jim:
Attempting to serialize a stream is also kind of like attempting to send a telephone through your telephone. You use the telephone to send messages, data. You don't use it to send other telephones; that makes no sense. You might want to transmit information like a telephone number, that someone else can then use to initiate their own telephone call. But the other person you tell the number to still needs to use their own telephone and dial the number themselves; you can't send them a phone over the phone so they can use it.
Awesome analogy Jim. Kudos!!
apigee, a better way to API!
Originally posted by Kalees Waran:
can we use OutputStream Object as return type of method in a EJB or RMI?
No
apigee, a better way to API!
Originally posted by Kalees Waran:
then,what are the return type we can use in RMI and EJB method call?
Any class that implements Serializable.
apigee, a better way to API!
Originally posted by Kalees Waran:
what is the reason EJB not supporting method return type as java.io class?
The EJB specification says so. If a managed bean uses any kind of I/O then that makes it hard for the app server to manage resources, and violates a number of assumptions about what the app server can or can not do with an EJB.
Jim mentioned earlier InputStream is already implement serialible object .then what is the trouble to use as return type
That's a misunderstanding. InputStream implements the serialization process; it does not implement the Serializable interface, not would it make sense for it to do so.
this link explain different implementation to send large file. could i know this is the right implementation of jms to sending large file? or its violating any EJB specification ..please suggest me...
Judge a man by his questions rather than his answers --Voltaire
SCJP 1.5 97%
Sheriff
[Ulf]: That's a misunderstanding. InputStream implements the serialization process; it does not implement the Serializable interface, not would it make sense for it to do so.
Also, I said that the File class implements Serializable. But InputStream classes do not.
"I'm not back." - Bill Harding, Twister
