Package com.mojang.realmsclient.client
Class FileUpload
java.lang.Object
com.mojang.realmsclient.client.FileUpload
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicBooleanprivate final Stringprivate final Fileprivate static final org.slf4j.Loggerprivate static final intprivate final longprivate final org.apache.http.client.config.RequestConfigprivate final Stringprivate final intprivate static final Stringprivate final UploadInfoprivate final UploadStatusprivate CompletableFuture<UploadResult> private final Stringprivate final String -
Constructor Summary
ConstructorsConstructorDescriptionFileUpload(File pFile, long pRealmId, int pSlotId, UploadInfo pUploadInfo, User pUser, String pClientVersiob, String pWorldVersion, UploadStatus pUploadStatus) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()private voidcleanup(org.apache.http.client.methods.HttpPost pPost, org.apache.http.impl.client.CloseableHttpClient pHttpClient) private longgetRetryDelaySeconds(org.apache.http.HttpResponse pHttpResponse) private voidhandleResponse(org.apache.http.HttpResponse pResponse, UploadResult.Builder pUploadResult) booleanprivate UploadResultrequestUpload(int pRetries) private UploadResultretryUploadAfter(long pSeconds, int pRetries) private voidsetupRequest(org.apache.http.client.methods.HttpPost pPost) private booleanshouldRetry(long pRetryDelaySeconds, int pRetries) voidupload(Consumer<UploadResult> pResultConsumer)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
MAX_RETRIES
private static final int MAX_RETRIES- See Also:
-
UPLOAD_PATH
- See Also:
-
file
-
realmId
private final long realmId -
slotId
private final int slotId -
uploadInfo
-
sessionId
-
username
-
clientVersion
-
worldVersion
-
uploadStatus
-
cancelled
-
uploadTask
-
requestConfig
private final org.apache.http.client.config.RequestConfig requestConfig
-
-
Constructor Details
-
FileUpload
public FileUpload(File pFile, long pRealmId, int pSlotId, UploadInfo pUploadInfo, User pUser, String pClientVersiob, String pWorldVersion, UploadStatus pUploadStatus)
-
-
Method Details
-
upload
-
cancel
public void cancel() -
requestUpload
- Parameters:
pRetries- The number of times this upload has already been attempted
-
cleanup
private void cleanup(org.apache.http.client.methods.HttpPost pPost, @Nullable org.apache.http.impl.client.CloseableHttpClient pHttpClient) -
setupRequest
private void setupRequest(org.apache.http.client.methods.HttpPost pPost) throws FileNotFoundException - Throws:
FileNotFoundException
-
handleResponse
private void handleResponse(org.apache.http.HttpResponse pResponse, UploadResult.Builder pUploadResult) throws IOException - Throws:
IOException
-
shouldRetry
private boolean shouldRetry(long pRetryDelaySeconds, int pRetries) -
retryUploadAfter
- Throws:
InterruptedException
-
getRetryDelaySeconds
private long getRetryDelaySeconds(org.apache.http.HttpResponse pHttpResponse) -
isFinished
public boolean isFinished()
-