Package ui.common.download
Klasse DownloadThread
java.lang.Object
java.lang.Thread
ui.common.download.DownloadThread
- Alle implementierten Schnittstellen:
Runnable,RBCWrapperDelegate
DownloadManager downloads a large file from a server. If the file is split into several chunks, it downloads them
separately and merges them altogether again. Each chunk is checked against its content length provided by HTTP. The
whole downloaded file is checked against the CRC checksum which is stored in the file with file extension crc.
Download file consists of:
Download file consists of:
<chunk>.001 <chunk>.002 ... <chunk>.<N> <file>.crc
(where the chunks will be merged to <file>.<ext>) or
<file>.<ext> <file>.crc
CRC file contents:
filename=<file>.<ext> size=<fileSizeInBytes> crc32=<8DigitsHexCRC32>
- Autor:
- Ken Händel
-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprivate final Configurationprivate final booleanstatic final Stringprivate final IDownloadListenerprivate static final Loggerstatic final intprivate static final intstatic final Stringprivate final URLVon Klasse geerbte Felder java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungDownloadThread(Configuration cfg, IDownloadListener listener, URL url, boolean handleCrcAndSplits) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic StringcalculateCRC32(File file) private booleanprivate booleancheckCrcOfAvailableFile(File file) private booleancheckExistingURL(URL currentURL) private FilecreateLocalFile(URL currentURL) private Fileprivate Fileprivate URLprivate URLgetURL(int part) private StringgetURLUsingExt(String ext) private booleanhasNextPart(int part) private booleanisAlreadyAvailableFile(long contentLength, File availableFile) private booleanprivate Fileprivate FilemergeChunks(List<File> chunks) voidrbcProgressCallback(double progress) voidrun()Von Klasse geerbte Methoden java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Felddetails
-
LOG
-
ILLEGAL_FILENAME_CHARS
- Siehe auch:
-
REPLACEMENT_ILLEGAL_CHAR
- Siehe auch:
-
MAX_BUFFER_SIZE
public static final int MAX_BUFFER_SIZE- Siehe auch:
-
MAX_TRY_COUNT
private static final int MAX_TRY_COUNT- Siehe auch:
-
config
-
url
-
listener
-
handleCrcAndSplits
private final boolean handleCrcAndSplits
-
-
Konstruktordetails
-
DownloadThread
public DownloadThread(Configuration cfg, IDownloadListener listener, URL url, boolean handleCrcAndSplits)
-
-
Methodendetails
-
run
public void run() -
checkCrcOfAvailableFile
-
isSplittedInChunks
- Löst aus:
MalformedURLExceptionURISyntaxException
-
hasNextPart
- Löst aus:
MalformedURLExceptionURISyntaxException
-
getCrcUrl
- Löst aus:
MalformedURLExceptionURISyntaxException
-
downloadAndMergeChunks
- Löst aus:
IOExceptionURISyntaxException
-
getURL
- Löst aus:
MalformedURLExceptionURISyntaxException
-
checkExistingURL
-
download
private File download(URL currentURL, boolean retry, boolean useAlreadyAvailableFile) throws IOException - Löst aus:
IOException
-
isAlreadyAvailableFile
-
createLocalFile
- Löst aus:
IOException
-
mergeChunks
- Löst aus:
IOException
-
merge
- Löst aus:
IOException
-
checkCrc
- Löst aus:
IOException
-
calculateCRC32
- Löst aus:
IOException
-
getURLUsingExt
-
rbcProgressCallback
public void rbcProgressCallback(double progress) - Angegeben von:
rbcProgressCallbackin SchnittstelleRBCWrapperDelegate
-