Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

check out object stream

Posted on 2012-03-23
5
Medium Priority
?
513 Views
Last Modified: 2012-06-08
I want to use both socket type , string and object stream.

sometime the socket will receive the data consists of String and sometime object.

It has to be just one port used.

so ,

I have to know the data in socket is String or object stream.
Is there way to check it out?

How can I solve this out?
0
Comment
Question by:gamjaradio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 26

Assisted Solution

by:ksivananth
ksivananth earned 1000 total points
ID: 37756018
can't you make the strings be sent as object?
0
 

Author Comment

by:gamjaradio
ID: 37756020
of course it is possbile.
but , there are so many code that I have to change.
0
 
LVL 26

Assisted Solution

by:ksivananth
ksivananth earned 1000 total points
ID: 37756027
>>but , there are so many code that I have to change.

I think, the only place where you'll have to make change is while writing and extracting data
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 1000 total points
ID: 37756059
Sure, you transmit ObjectStream and when you get back Object using instanceof operator
check all possible types to which Object can belong  including String and other possible objects which you'll transmit. You can create such method and replcae in all places
0
 
LVL 47

Accepted Solution

by:
for_yan earned 1000 total points
ID: 37756073
Do you really have many places where you are sending and receiveing them bothe wyas where you need to change?
Post the code how you do it in each case, maybe we could think of some way to minimize changes
Do you have big numbers of both cases?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question