+ downloaderNoCache = downloader;
+ cache = new CacheMemory();
+ }
+
+ /**
+ * This {@link Downloader} is forbidden to try and connect to the network.
+ * <p>
+ * If TRUE, it will only check the cache (even in no-cache mode!).
+ * <p>
+ * Default is FALSE.
+ *
+ * @return TRUE if offline
+ */
+ public boolean isOffline() {
+ return offline;
+ }
+
+ /**
+ * This {@link Downloader} is forbidden to try and connect to the network.
+ * <p>
+ * If TRUE, it will only check the cache (even in no-cache mode!).
+ * <p>
+ * Default is FALSE.
+ *
+ * @param offline TRUE for offline, FALSE for online
+ */
+ public void setOffline(boolean offline) {
+ this.offline = offline;
+ downloader.setOffline(offline);
+ downloaderNoCache.setOffline(offline);
+
+ // If we don't, we cannot support no-cache using code in OFFLINE mode
+ if (offline) {
+ downloaderNoCache.setCache(cache);
+ } else {
+ downloaderNoCache.setCache(null);
+ }
+ }
+
+ /**
+ * The traces handler for this {@link Cache}.
+ *
+ * @param tracer
+ * the new traces handler
+ */
+ public void setTraceHandler(TraceHandler tracer) {
+ downloader.setTraceHandler(tracer);
+ downloaderNoCache.setTraceHandler(tracer);
+ cache.setTraceHandler(tracer);
+ if (downloader.getCache() != null) {
+ downloader.getCache().setTraceHandler(tracer);
+ }
+