Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

BufferedWriter and Filewriter

Options
  • 03-05-2007 5:23pm
    #1
    Registered Users Posts: 1,552 ✭✭✭


    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