diff options
Diffstat (limited to 'src/io/DataWriter.java')
-rw-r--r-- | src/io/DataWriter.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/io/DataWriter.java b/src/io/DataWriter.java index ec7a30e..4f4c022 100644 --- a/src/io/DataWriter.java +++ b/src/io/DataWriter.java @@ -5,6 +5,7 @@ import java.io.Closeable; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; +import java.io.Flushable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -24,7 +25,7 @@ import provider.ResultListener; * * @author Maurice Laveaux */ -public class DataWriter implements ResultListener, Closeable { +public class DataWriter implements ResultListener, Closeable, Flushable { /** * The writer for the tweet stream. @@ -148,6 +149,11 @@ public class DataWriter implements ResultListener, Closeable { return Logger.getLogger(getClass().getName()); } + @Override + public void flush() throws IOException { + m_tweet.flush(); + } + abstract class Store { private final String filename; @@ -204,6 +210,12 @@ public class DataWriter implements ResultListener, Closeable { * @throws IOException if no input file can be retrieved. */ abstract public InputStream getInputStream() throws IOException; + + private void flush() throws IOException { + if (os != null) { + os.flush(); + } + } } class SimpleFileStore extends Store { |