I am writing the below code that this code basically writes to a file through buffered writer, I am using JDK 1.5, now my query is that basically this code works perfectly and writes to the file , the file is big let say about the final size of the file is about 1GB, now please let me is there any other alternative offered by Java in JDK 1.5 which could make file writer process even more faster and improve the performance?
File file = new File(FilePath + getFileName());
try (BufferedWriter bw = new BufferedWriter(new FileWriter(file))) {
for (Posuser posuser : totalusers) {
for (potook bk : books) {
if ((posuser.getUpdatedBy() == null)
&& (posuser.getUpdateddateformat() == null)) {
bw.write("aaa"+"\r\n");
} else if (posuser.getUpdatedBy() == null
&& posuser.getUpdateddateformat() != null) {
bw.write("bbb+"\r\n");
} else if (posuser.getUpdatedBy() != null
&& posuser.getUpdateddateformat() == null) {
bw.write("ccc"+"\r\n");
} else {
bw.write("ddd"+\r\n");
}
}
}
} catch (IOException, AnotherException e) {
logger.error(e.getMessage());
}