temporary file creation functionality
This commit is contained in:
parent
c09edc1103
commit
e42f0ac225
28
src/main/java/model/TemporaryFile.java
Normal file
28
src/main/java/model/TemporaryFile.java
Normal file
@ -0,0 +1,28 @@
|
||||
package model;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TemporaryFile {
|
||||
public static final String FILE_NAME = "temporary_file.txt";
|
||||
|
||||
public void createEmptyFile() {
|
||||
try {
|
||||
FileWriter fileWriter = new FileWriter(FILE_NAME);
|
||||
fileWriter.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void addToFile(String fileInput) {
|
||||
try {
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(FILE_NAME, true));
|
||||
writer.write(fileInput + "\n");
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user