Two Laptop Bag*
The moose likes Java in General and the fly likes how to put an object into ByteBuffer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to put an object into ByteBuffer" Watch "how to put an object into ByteBuffer" New topic
Author

how to put an object into ByteBuffer

tanshu sharma
Greenhorn

Joined: Mar 09, 2013
Posts: 4
hii..every one...
can anybody please help me...in putting the Message object into a byteBuffer...



now the problem is..how to retrieve Msg1 from String...
otherwise how to sent it directly in bytes....

its..extremly urgent.......
thanks in advance.....
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7718
    
  20

its..extremly urgent.......

Well, I'm afraid that's your problem, not ours, so EaseUp (←click).

tanshu sharma wrote:now the problem is..how to retrieve Msg1 from String...

Answer: with difficulty, because StringsAreBad (←click).

otherwise how to sent it directly in bytes....

I suggest you have a look at all those put...() methods in ByteBuffer, and think how you might use them.

I'd also suggest that you think about driving this from your Message class, rather than from outside it. For example, what about amethod?

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to put an object into ByteBuffer