Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

BufferedWriter and Filewriter

  • 03-05-2007 05:23PM
    #1
    Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭


    Hi Im using bufferedwriter with filewriter inside its parameter but find that its causing line breaks to occur at random places.
    Is there any way of overcoming this problem?
    This is the code of the method thats causing the problem

    public void writeFile(String username, String domain, WBListFileContents wbList) throws IOException {

    File spamListFile = getSpamListFile(username,domain);

    logger.info("started remote writeFile to "+spamListFile);
    logger.finest("file contents:\n" + wbList.getFileContents());

    String contents = "";
    int lSize = 0;

    FileWriter fw = new FileWriter(spamListFile);

    BufferedWriter bw = null;

    try {
    bw = new BufferedWriter(fw);
    // Now put together the contents of the file:
    bw.write(wbList==null ? "" : wbList.getFileContents());
    }
    catch(IOException ioe) {
    throw ioe;
    }
    finally {
    if(bw!=null) bw.close();
    }
    }


Advertisement