com.github.axet.wget.info
Class DownloadInfo

java.lang.Object
  extended by com.github.axet.wget.info.URLInfo
      extended by com.github.axet.wget.info.DownloadInfo

public class DownloadInfo
extends URLInfo

DownloadInfo class. Keep part information. We need to serialize this class between application restart. Thread safe.

Author:
axet

Nested Class Summary
static class DownloadInfo.Part
           
 
Nested classes/interfaces inherited from class com.github.axet.wget.info.URLInfo
URLInfo.States
 
Field Summary
static long PART_LENGTH
           
 
Constructor Summary
DownloadInfo(URL source)
           
 
Method Summary
 void calculate()
          for multi part download, call every time when we need to know totol download progress
 void copy(DownloadInfo oldSource)
          copy resume data from oldSource;
 void enableMultipart()
           
 void extract(AtomicBoolean stop, Runnable notify)
           
 long getCount()
           
 List<DownloadInfo.Part> getParts()
           
 boolean multipart()
          is it a multipart download?
 void reset()
           
 boolean resume(DownloadInfo newSource)
          Check if we can continue download a file from new source.
 void setCount(long count)
           
 
Methods inherited from class com.github.axet.wget.info.URLInfo
empty, extract, extractNormal, extractRange, getContentFilename, getContentType, getDelay, getException, getLength, getRange, getSource, getState, setDelay, setException, setRange, setState, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PART_LENGTH

public static final long PART_LENGTH
See Also:
Constant Field Values
Constructor Detail

DownloadInfo

public DownloadInfo(URL source)
Method Detail

multipart

public boolean multipart()
is it a multipart download?

Returns:

reset

public void reset()

calculate

public void calculate()
for multi part download, call every time when we need to know totol download progress


getParts

public List<DownloadInfo.Part> getParts()

enableMultipart

public void enableMultipart()

resume

public boolean resume(DownloadInfo newSource)
Check if we can continue download a file from new source. Check if new souce has the same file length, title. and supports for range

Parameters:
newSource - new source
Returns:
true - possible to resume from new location

copy

public void copy(DownloadInfo oldSource)
copy resume data from oldSource;


getCount

public long getCount()

setCount

public void setCount(long count)

extract

public void extract(AtomicBoolean stop,
                    Runnable notify)
Overrides:
extract in class URLInfo


Copyright © 2012. All Rights Reserved.