Thread: BufferedReader problems...

Results 1 to 5 of 5
  1. #1 BufferedReader problems... 
    Banned

    Join Date
    Jan 2009
    Posts
    777
    Thanks given
    74
    Thanks received
    61
    Rep Power
    0
    Well I am very rusty with java and am having problems using the bufferedreader/writer..

    I need to know how to read and write data on the same line but seperately.

    For example in my txt file i want to have:

    Code:
    torque	varrock
    you	falador
    etc	lumbridge
    the values in each column are stored in seperate arraylists. if you need more information to help, which im sure you will, just ask
    Reply With Quote  
     

  2. #2  
    Registered Member
    Its paris's Avatar
    Join Date
    Apr 2009
    Posts
    1,141
    Thanks given
    56
    Thanks received
    234
    Rep Power
    689
    Just as you would with items.cfg or anything alike. Use a symbol to distinguish the words (can be space, tabs (\t) or anything else) then split the read String (line) into a StringArray.
    Reply With Quote  
     

  3. #3  
    Ready for Battle


    Join Date
    Aug 2009
    Age
    28
    Posts
    368
    Thanks given
    87
    Thanks received
    34
    Rep Power
    99
    if (token.equals("torque")
    p.location = token2;

    something like that, thats just a rough version of it
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jan 2009
    Posts
    777
    Thanks given
    74
    Thanks received
    61
    Rep Power
    0
    Quote Originally Posted by TheChosenOne View Post
    Just as you would with items.cfg or anything alike. Use a symbol to distinguish the words (can be space, tabs (\t) or anything else) then split the read String (line) into a StringArray.
    Thanks,
    Reply With Quote  
     

  5. #5  
    Registered Member
    Mister Maggot's Avatar
    Join Date
    Dec 2008
    Posts
    7,227
    Thanks given
    3,283
    Thanks received
    2,875
    Rep Power
    5000
    Code:
    List list1 = new List();
    List list2 = new List()
    BuffRead in = new BuffRead(FileRead("in.txt");
    Strng ln;
    while((ln = in.readLn()) != null) {
             list1.add(ln.split(regex)[0].trim());
             list2.add(ln.split(regex)[1].trim());
    }
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

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