public SplitFileFetcher(ClientGetter getter, DataInputStream dis, ClientContext context) throws StorageFormatException, ResumeFailedException, IOException { Logger.normal(this, "Resuming splitfile download for "+this); boolean completeViaTruncation = dis.readBoolean(); if(completeViaTruncation) { fileCompleteViaTruncation = new File(dis.readUTF()); if(!fileCompleteViaTruncation.exists()) throw new ResumeFailedException("Storage file does not exist: "+fileCompleteViaTruncation); callbackCompleteViaTruncation = (FileGetCompletionCallback) getter; long rafSize = dis.readLong(); if(fileCompleteViaTruncation.length() != rafSize) throw new ResumeFailedException("Storage file is not of the correct length"); // FIXME check against finalLength too, maybe we can finish straight away. this.raf = new PooledFileRandomAccessBuffer(fileCompleteViaTruncation, false, rafSize, null, -1, true); } else { this.raf = BucketTools.restoreRAFFrom(dis, context.persistentFG, context.persistentFileTracker, context.getPersistentMasterSecret()); fileCompleteViaTruncation = null; callbackCompleteViaTruncation = null; } this.parent = getter; this.cb = getter; this.persistent = true; this.realTimeFlag = parent.realTimeFlag(); token = dis.readLong(); this.blockFetchContext = getter.ctx; this.wantBinaryBlob = getter.collectingBinaryBlob(); // onResume() will do the rest. Logger.normal(this, "Resumed splitfile download for "+this); lastNotifiedStoreFetch = System.currentTimeMillis(); }
this.context = context; if(parent instanceof ClientGetter) { wantBinaryBlob = ((ClientGetter)parent).collectingBinaryBlob(); } else { wantBinaryBlob = false;
(parent instanceof ClientGetter ? ((ClientGetter)parent).collectingBinaryBlob() : false), persistent);