Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt on WMA Spec

 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In chapter-1, first paragraph of page 2, which is as the following
The generic connection framework includes convenience methods for getting InputStream and OutputStream handles for connections which are StreamConnections. The MessageConnection does not support stream based operations. If an application calls the Connector.open*Stream methods, they will receive an IllegalArgumentException.


Does it mean that we cannot use StreamConnection to send Message? Any kind of message, no matter whether it is TextMessage or BinaryMessage? If so, why there is such method to open *Stream in Connector class?

Any comment and explanation are welcome...
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Message is considered as a packet of data that is transferred between two applications and hence does not really adhere to the concept of streams (streams imply that the data is continuous rather than discrete).

I guess this is one of the trade-offs that one has to make when creating a framework. Frameworks typically will gel with 90% of the code but there might be some instances where it might not be a perfect fit. In such cases, an option is to throw something like an IllegalArgumentException or a UnsupportedMethodException (this is not in J2ME though).
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sathya Srinivasan:
(streams imply that the data is continuous rather than discrete).


Of course it is!!!
I got it now... Thanks, Sathya...
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!