Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-20-2009, 11:37 AM
Member
 
Join Date: Jan 2009
Posts: 1
Rep Power: 0
QPRocky is on a distinguished road
Default Buffer
Hi.

I'm coding TCPClient and have question about buffer.
How can I fill buffer with misc data (ie. bytes, chars, ints, strings)
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 01-21-2009, 06:29 PM
Member
 
Join Date: Jan 2009
Posts: 13
Rep Power: 0
guneet singh is on a distinguished road
Default
i m not clear what u r saying ...
well u can put any thing in buffer by...
byte[] buffer=new byte[1024];
while(any condition)
buffer.read(cond1,limit1,limit2)
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 02-02-2009, 04:54 PM
Steve11235's Avatar
Senior Member
 
Join Date: Dec 2008
Posts: 969
Rep Power: 2
Steve11235 is on a distinguished road
Default
Look at SocketChannel and ByteBuffer. Note that ByteBuffer only deals with primitive types, such as char. You can not read a String from it directly. You can read a sequence of char and assemble them in a StringBuilder.

Keep in mind that the server and the client must be in *complete* agreement about what is sent back and forth.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Non Allocating String Buffer chrisdb89 New To Java 5 10-25-2008 07:57 AM
how to redirect the output buffer of pl/sql onto a jsp sriavr Database 0 03-11-2008 01:25 PM
Trouble with Buffer Sizing Jeff New To Java 3 02-07-2008 02:43 PM
Help with String Buffer mathias AWT / Swing 1 08-07-2007 07:52 AM
how to set the value of BUFFER SIZE oregon Advanced Java 1 08-06-2007 04:16 AM


All times are GMT +2. The time now is 08:58 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org