package net.pterodactylus.sone.core;
+import static java.util.logging.Level.FINER;
import static net.pterodactylus.sone.data.Sone.TO_FREENET_URI;
import java.io.InputStream;
/* TODO - mark Sone as bad. */
return null;
}
+ if (shouldStop()) {
+ logger.log(FINER, "Sone was stopped, won’t process download.");
+ return null;
+ }
logger.log(Level.FINEST, String.format("Got %d bytes back.", fetchResults.getFetchResult().size()));
Sone parsedSone = parseSone(sone, fetchResults.getFetchResult(), fetchResults.getFreenetUri());
if (parsedSone != null) {
* @param soneInputStream
* The input stream to parse the Sone from
* @return The parsed Sone
- * @throws SoneException
- * if a parse error occurs, or the protocol is invalid
*/
- public Sone parseSone(Sone originalSone, InputStream soneInputStream) throws SoneException {
- return new SoneParser(core).parseSone(originalSone, soneInputStream);
+ public Sone parseSone(Sone originalSone, InputStream soneInputStream) {
+ return new SoneParser().parseSone(core.getDatabase(), originalSone, soneInputStream);
}
//