Class FileDownload
java.lang.Object
com.mojang.realmsclient.client.FileDownload
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate @Nullable Threadprivate booleanprivate booleanprivate booleanprivate static final String[]private static final org.slf4j.Loggerprivate @Nullable CompletableFuture<?> private Fileprivate @Nullable File -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()static OptionalLongcontentLength(String downloadLink) private static HttpClientprivate static HttpRequest.BuildercreateRequest(String downloadLink) voiddownload(WorldDownload worldDownload, String worldName, RealmsDownloadLatestWorldScreen.DownloadStatus downloadStatus, LevelStorageSource levelStorageSource) private voiddownload(RealmsDownloadLatestWorldScreen.DownloadStatus downloadStatus, HttpClient client, String url, File target) static StringfindAvailableFolderName(String folder) Modifies a folder name to make sure it is valid to store on disk.private voidfinishResourcePackDownload(RealmsDownloadLatestWorldScreen.DownloadStatus downloadStatus, File tempFile, WorldDownload worldDownload) private voidfinishWorldDownload(String worldName, File tempFile, LevelStorageSource levelStorageSource, RealmsDownloadLatestWorldScreen.DownloadStatus downloadStatus) booleanisError()booleanbooleanprivate <T> @Nullable TjoinCancellableRequest(CompletableFuture<T> pendingRequest) private voiduntarGzipArchive(String name, @Nullable File file, LevelStorageSource levelStorageSource)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
cancelled
private volatile boolean cancelled -
finished
private volatile boolean finished -
error
private volatile boolean error -
extracting
private volatile boolean extracting -
tempFile
-
resourcePackPath
-
pendingRequest
-
currentThread
-
INVALID_FILE_NAMES
-
-
Constructor Details
-
FileDownload
public FileDownload()
-
-
Method Details
-
joinCancellableRequest
private <T> @Nullable T joinCancellableRequest(CompletableFuture<T> pendingRequest) throws Throwable - Throws:
Throwable
-
createClient
-
createRequest
-
contentLength
-
download
public void download(WorldDownload worldDownload, String worldName, RealmsDownloadLatestWorldScreen.DownloadStatus downloadStatus, LevelStorageSource levelStorageSource) -
download
private void download(RealmsDownloadLatestWorldScreen.DownloadStatus downloadStatus, HttpClient client, String url, File target) throws IOException - Throws:
IOException
-
cancel
public void cancel() -
isFinished
public boolean isFinished() -
isError
public boolean isError() -
isExtracting
public boolean isExtracting() -
findAvailableFolderName
-
untarGzipArchive
private void untarGzipArchive(String name, @Nullable File file, LevelStorageSource levelStorageSource) throws IOException - Throws:
IOException
-
finishWorldDownload
private void finishWorldDownload(String worldName, File tempFile, LevelStorageSource levelStorageSource, RealmsDownloadLatestWorldScreen.DownloadStatus downloadStatus) -
finishResourcePackDownload
private void finishResourcePackDownload(RealmsDownloadLatestWorldScreen.DownloadStatus downloadStatus, File tempFile, WorldDownload worldDownload)
-