summaryrefslogtreecommitdiff
path: root/src/main/TweetShell.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/TweetShell.java')
-rw-r--r--src/main/TweetShell.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/main/TweetShell.java b/src/main/TweetShell.java
index fae4125..cb31511 100644
--- a/src/main/TweetShell.java
+++ b/src/main/TweetShell.java
@@ -37,6 +37,12 @@ public class TweetShell implements TwitterApi.PinSupplier {
private Stream stream_cached;
private final CompositeResultListener resultListeners;
+ /**
+ * Whether to convert uncompressed tweet files (e.g. "tweets.txt") to the
+ * compressed files ("tweets.txt.gz").
+ */
+ public final static String CFG_CONVERT_UNCOMPRESSED = "convert-uncompressed";
+
public TweetShell() {
resultListeners = new CompositeResultListener();
// by default, store something that counts responses
@@ -420,13 +426,19 @@ public class TweetShell implements TwitterApi.PinSupplier {
if (DataWriter.class.isAssignableFrom(rlCls)) {
Configuration config = Configuration.getConfig();
+ if (resultListeners.findListener(CompressableDataWriter.class) != null
+ || resultListeners.findListener(DataWriter.class) != null) {
+ System.err.println("Cannot enable both file and cfile.");
+ return false;
+ }
+
String tweetsFilename = config.getProperty(DataWriter.CFG_TWEETS_FILENAME);
try {
DataWriter dw;
if (CompressableDataWriter.class.isAssignableFrom(rlCls)) {
// compressed stream, convert by default (removing orig)
boolean convertUncompressed = Boolean.parseBoolean(
- config.getProperty("convert-uncompressed", "true"));
+ config.getProperty(CFG_CONVERT_UNCOMPRESSED, "true"));
dw = new CompressableDataWriter(
tweetsFilename, convertUncompressed);
} else {
@@ -434,8 +446,6 @@ public class TweetShell implements TwitterApi.PinSupplier {
}
dw.open();
resultListeners.register(dw);
- // save the changes to the config.
- config.save();
} catch (IOException ex) {
System.err.println("Could not open file for storing tweets:");
System.err.println(ex.getMessage());