Skip to content

Commit

Permalink
Create SimpleTextFileWriter.java
Browse files Browse the repository at this point in the history
  • Loading branch information
JuicyDragon committed May 14, 2019
1 parent b4cd9b5 commit 324011e
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.nuix.superutilities.loadfiles;

import java.io.Closeable;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class SimpleTextFileWriter implements Closeable {
protected File destinationFile;
protected PrintWriter pw;
protected FileWriter fw;

public SimpleTextFileWriter(File destinationFile) throws IOException {
this.destinationFile = destinationFile;
fw = new FileWriter(destinationFile);
pw = new PrintWriter(fw);
}

public void writeLine(String line) {
pw.println(line);
}

public File getDestinationFile() {
return destinationFile;
}

@Override
public void close() throws IOException {
if(pw != null) { pw.close(); }
if(fw != null) { fw.close(); }
}
}

0 comments on commit 324011e

Please sign in to comment.