aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/files/FileParser.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/files/FileParser.java')
-rw-r--r--main/src/cgeo/geocaching/files/FileParser.java19
1 files changed, 8 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/files/FileParser.java b/main/src/cgeo/geocaching/files/FileParser.java
index 9521c70..9c70a0d 100644
--- a/main/src/cgeo/geocaching/files/FileParser.java
+++ b/main/src/cgeo/geocaching/files/FileParser.java
@@ -16,7 +16,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Collection;
-import java.util.Date;
import java.util.concurrent.CancellationException;
public abstract class FileParser {
@@ -24,25 +23,22 @@ public abstract class FileParser {
* Parses caches from input stream.
*
* @param stream
+ * the input stream
* @param progressHandler
- * for reporting parsing progress (in bytes read from input stream)
+ * for reporting parsing progress (in bytes read from input stream)
* @return collection of caches
* @throws IOException
- * if the input stream can't be read
+ * if the input stream can't be read
* @throws ParserException
- * if the input stream contains data not matching the file format of the parser
+ * if the input stream contains data not matching the file format of the parser
*/
+ @NonNull
public abstract Collection<Geocache> parse(@NonNull final InputStream stream, @Nullable final CancellableHandler progressHandler) throws IOException, ParserException;
/**
* Convenience method for parsing a file.
- *
- * @param file
- * @param progressHandler
- * @return
- * @throws IOException
- * @throws ParserException
*/
+ @NonNull
public Collection<Geocache> parse(final File file, final CancellableHandler progressHandler) throws IOException, ParserException {
final BufferedInputStream stream = new BufferedInputStream(new FileInputStream(file));
try {
@@ -52,6 +48,7 @@ public abstract class FileParser {
}
}
+ @NonNull
protected static StringBuilder readStream(@NonNull final InputStream is, @Nullable final CancellableHandler progressHandler) throws IOException {
final StringBuilder buffer = new StringBuilder();
final ProgressInputStream progressInputStream = new ProgressInputStream(is);
@@ -84,7 +81,7 @@ public abstract class FileParser {
} else {
cache.setInventoryItems(0);
}
- final long time = new Date().getTime();
+ final long time = System.currentTimeMillis();
cache.setUpdated(time);
cache.setDetailedUpdate(time);
}