diff --git a/src/main/java/com/vectron/fcl/FclStack.java b/src/main/java/com/vectron/fcl/FclStack.java index 5740da8..878192e 100644 --- a/src/main/java/com/vectron/fcl/FclStack.java +++ b/src/main/java/com/vectron/fcl/FclStack.java @@ -2,9 +2,7 @@ package com.vectron.fcl; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -// import com.vectron.forthcalc.domain.ports.FileStore; import com.vectron.fcl.types.Obj; -import com.vectron.fcl.FclTypeAdapter; import java.io.BufferedReader; import java.io.FileInputStream; @@ -77,8 +75,6 @@ public class FclStack { Collections.reverse(stack); } -// TODO -/* public void load(FileStore fileStore, String id) { FileInputStream stream = null; try { @@ -107,5 +103,4 @@ public class FclStack { private String fileName(String id) { return String.format("stack%s.json", id); } -*/ } diff --git a/src/main/java/com/vectron/fcl/FileStore.java b/src/main/java/com/vectron/fcl/FileStore.java new file mode 100644 index 0000000..97458f8 --- /dev/null +++ b/src/main/java/com/vectron/fcl/FileStore.java @@ -0,0 +1,23 @@ +package com.vectron.fcl; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.List; + +public interface FileStore { + void save(byte[] raw, String fileName); + + List list(); + + List list(Predicate p); + + String read(String fileName); + + FileInputStream open(String fileName) throws FileNotFoundException; + + boolean delete(String fileName); + + interface Predicate { + boolean isTrue(T v); + } +} diff --git a/src/test/java/com/vectron/fcl/FclTest.java b/src/test/java/com/vectron/fcl/FclTest.java index 1752103..dde47b5 100644 --- a/src/test/java/com/vectron/fcl/FclTest.java +++ b/src/test/java/com/vectron/fcl/FclTest.java @@ -1,8 +1,5 @@ package com.vectron.fcl; -import com.vectron.fcl.Fcl; -import com.vectron.fcl.FclStack; -import com.vectron.fcl.RamTranscript; import com.vectron.fcl.exceptions.Aborted; import com.vectron.fcl.exceptions.NotUnderstood; import com.vectron.fcl.exceptions.TypeMismatched;