Mercurial > hg > Database > jungle-network
diff src/alice/jungle/persistence/PersistentJournal.java @ 86:bcaf28f8244d
Added PersistentChageList and PersistentJournalTest
author | one |
---|---|
date | Tue, 29 Oct 2013 16:52:12 +0900 |
parents | e641f559559c |
children | 0c98717f186e |
line wrap: on
line diff
--- a/src/alice/jungle/persistence/PersistentJournal.java Mon Oct 28 17:21:56 2013 +0900 +++ b/src/alice/jungle/persistence/PersistentJournal.java Tue Oct 29 16:52:12 2013 +0900 @@ -19,8 +19,12 @@ private static PersistentChangeListWriter WRITER; private static PersistentChangeListReader READER; private static MessagePack msgpack; - private static OutputStream out; - private static InputStream in; + private static OutputStream out = null; + private static InputStream in = null; + + public PersistentJournal() { + msgpack = new MessagePack(); + } public PersistentJournal(File file) throws FileNotFoundException { out = new FileOutputStream(file, true); @@ -40,6 +44,16 @@ return WRITER; } + public void setOutputFile(File file) throws FileNotFoundException { + out = new FileOutputStream(file); + WRITER = new PersistentChangeListWriter(out); + } + + public void setInputFile(File file) throws FileNotFoundException { + in = new FileInputStream(file); + READER = new PersistentChangeListReader(in); + } + public void close() throws IOException { out.close(); in.close();