
package forager.server;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;

public class ListManager {

    private FileOutputStream taskListOut;
    private PrintWriter taskListWriter;

    public ListManager() throws IOException {
        String taskList = "tasklist";
        taskListOut = new FileOutputStream(taskList, true);
        taskListWriter = new PrintWriter(new BufferedOutputStream(taskListOut));
    }

    public void addTask(String command) {
        taskListWriter.println(command);
    }

    public void sync() throws IOException {
        taskListWriter.flush();
        taskListOut.getFD().sync();
    }
}

@@ -174,16 +174,80 @@
 ager %7B%0A%0A
+    public static final String DEFAULT_LIST_NAME = %22tasklist%22;%0A%0A
     priv
@@ -330,86 +330,246 @@
    p
-ublic ListManager() throws IOException %7B%0A        String taskList = %22tasklist%22;
+rivate FileOutputStream completedListOut;%0A    private PrintWriter completedListWriter;%0A%0A    public ListManager() throws IOException %7B%0A        this(DEFAULT_LIST_NAME);%0A    %7D%0A%0A    public ListManager(String taskListName) throws IOException %7B
 %0A   
@@ -616,16 +616,20 @@
 taskList
+Name
 , true);
@@ -670,16 +670,33 @@
 tWriter(
+%0A                
 new Buff
@@ -731,69 +731,407 @@
 ));%0A
-    %7D%0A%0A    public void addTask(String command) %7B%0A        task
+%0A        String completedName = taskListName + %22.done%22;%0A        completedListOut = new FileOutputStream(completedName, true);%0A        completedListWriter = new PrintWriter(%0A                new BufferedOutputStream(completedListOut));%0A    %7D%0A%0A    public void addTask(String command) %7B%0A        taskListWriter.println(command);%0A    %7D%0A%0A    public void addCompletedTask(String command) %7B%0A        completed
 List

Add completed task file implementation