Results 1 to 6 of 6
  1. #1
    chrisdb89 is offline Member
    Join Date
    Oct 2008
    Posts
    4
    Rep Power
    0

    Default Non Allocating String Buffer

    whoops. didn't mean to delete that.
    Last edited by chrisdb89; 12-07-2008 at 04:53 PM.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Can you explain your question little more clear.

    You want to create some arrays and then you want to add those arrays into a linked list and then you want to add those link list to string buffer, is it?

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,609
    Rep Power
    23

    Default

    Some ideas on the design. Do it in simple steps first. Then make it more complicated.
    Create an array to hold strings as they are appended. Don't worry about overflow yet. That's part 2.
    Increment length as strings are appended.
    Write a toString method that creates a StringBuffer and fills it from what's been stored in the array. Create and return a String from the StringBuffer.
    Get that to work, write a small main() method to test it,
    then move on the making a linked list of these arrays.

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,609
    Rep Power
    23

    Default

    public int length();
    I was refering to what the above would return? Yes it would be a variable with the total number of chars in all the string stored. Has nothing to do with overflow in my design.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default

    Just another cross poster.
    New To Java - NonAllocating StringBuffer Help

    db

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    If you want to handle the overflow in dynamic incrementing of number of element, you have to choose another collection framework, may be ArrayList would be the solution.

Similar Threads

  1. Replies: 0
    Last Post: 03-11-2008, 12:25 PM
  2. Trouble with Buffer Sizing
    By Jeff in forum New To Java
    Replies: 3
    Last Post: 02-07-2008, 01:43 PM
  3. Http Buffer issue... chunked?
    By jlew in forum Networking
    Replies: 1
    Last Post: 11-04-2007, 05:45 PM
  4. Help with String Buffer
    By mathias in forum AWT / Swing
    Replies: 1
    Last Post: 08-07-2007, 06:52 AM
  5. how to set the value of BUFFER SIZE
    By oregon in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 03: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
  •