Package com.mojang.realmsclient.client
Class FileDownload
java.lang.Object
com.mojang.realmsclient.client.FileDownload
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class -
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 url) private static HttpClientprivate static HttpRequest.BuildercreateRequest(String url) voiddownload(WorldDownload download, String worldName, RealmsDownloadLatestWorldScreen.DownloadStatus status, LevelStorageSource source) private voiddownload(RealmsDownloadLatestWorldScreen.DownloadStatus status, HttpClient client, String url, File tempFile) static StringfindAvailableFolderName(String folderName) Modifies a folder name to make sure it is valid to store on disk.private voidfinishResourcePackDownload(RealmsDownloadLatestWorldScreen.DownloadStatus status, File tempFile, WorldDownload worldDownload) private voidfinishWorldDownload(String worldName, File tempFile, LevelStorageSource source, RealmsDownloadLatestWorldScreen.DownloadStatus status) booleanisError()booleanbooleanprivate <T> @Nullable TjoinCancellableRequest(CompletableFuture<T> request) private voiduntarGzipArchive(String worldName, @Nullable File tempFile, 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
- Throws:
Throwable
-
createClient
-
createRequest
-
contentLength
-
download
public void download(WorldDownload download, String worldName, RealmsDownloadLatestWorldScreen.DownloadStatus status, LevelStorageSource source) -
download
private void download(RealmsDownloadLatestWorldScreen.DownloadStatus status, HttpClient client, String url, File tempFile) throws IOException - Throws:
IOException
-
cancel
public void cancel() -
isFinished
public boolean isFinished() -
isError
public boolean isError() -
isExtracting
public boolean isExtracting() -
findAvailableFolderName
Modifies a folder name to make sure it is valid to store on disk.- Parameters:
folderName- The folder name to modify- Returns:
- the modified folder name
-
untarGzipArchive
private void untarGzipArchive(String worldName, @Nullable File tempFile, LevelStorageSource levelStorageSource) throws IOException - Throws:
IOException
-
finishWorldDownload
private void finishWorldDownload(String worldName, File tempFile, LevelStorageSource source, RealmsDownloadLatestWorldScreen.DownloadStatus status) -
finishResourcePackDownload
private void finishResourcePackDownload(RealmsDownloadLatestWorldScreen.DownloadStatus status, File tempFile, WorldDownload worldDownload)
-