Results 1 to 2 of 2
  1. #1
    seven is offline Member
    Join Date
    Feb 2012
    Posts
    3
    Rep Power
    0

    Default bufferedReader (or alternative)? Help!

    Ok, have to read a file over the network. The way I'm going about the project I'm splitting the file into strings, placing the strings into an array. The strings are separated by '%' so I'm using that as my delimiter. I'm using bufferedreader. If the strings are 1 lines, everything is fine

    e.g.

    the brown fox ran quickly.

    returns
    the brown fox ran quickly.

    however if the strings are multiple lines, only the last line gets returned.

    e.g.

    the brown fox ran quickly.
    the red fox ran quicker.
    the orange fox was even faster.

    returns
    the orange fox was even faster.


    hopefully that makes sense? question is i know buffered reader reads at a line at a time, so it seems by design it SHOULD only be printing the last line prior to the delimiter, but how can I make it read/output ALL the lines up until the previous delimiter? Is bufferedreader what I should be using for this? Possibly something else would work better?

    Thanks much in advance!

  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

Similar Threads

  1. Which would be the most effecient alternative?
    By Krystah in forum New To Java
    Replies: 3
    Last Post: 04-18-2011, 10:56 PM
  2. BufferedReader alternative for large input
    By HannesV in forum Advanced Java
    Replies: 0
    Last Post: 10-19-2010, 04:56 PM
  3. Is EJB an alternative for JDBC?
    By makpandian in forum Enterprise JavaBeans (EJB)
    Replies: 4
    Last Post: 01-06-2010, 09:14 AM
  4. Looking for alternative to Web Start
    By SamSam in forum Advanced Java
    Replies: 1
    Last Post: 05-06-2009, 07:19 PM
  5. Any Alternative to Swing?
    By Niveditha in forum AWT / Swing
    Replies: 13
    Last Post: 06-27-2008, 09:39 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
  •