Results 1 to 3 of 3

Thread: Buffer

  1. #1
    QPRocky is offline Member
    Join Date
    Jan 2009
    Posts
    1
    Rep Power
    0

    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)

  2. #2
    guneet singh is offline Member
    Join Date
    Jan 2009
    Posts
    13
    Rep Power
    0

    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)

  3. #3
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    8

    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.

Similar Threads

  1. Non Allocating String Buffer
    By chrisdb89 in forum New To Java
    Replies: 5
    Last Post: 10-25-2008, 07:57 AM
  2. Replies: 0
    Last Post: 03-11-2008, 01:25 PM
  3. Trouble with Buffer Sizing
    By Jeff in forum New To Java
    Replies: 3
    Last Post: 02-07-2008, 02:43 PM
  4. Help with String Buffer
    By mathias in forum AWT / Swing
    Replies: 1
    Last Post: 08-07-2007, 07:52 AM
  5. how to set the value of BUFFER SIZE
    By oregon in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 04:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •