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 AtomicBoolean
private final String
private final File
private static final org.slf4j.Logger
private static final int
private final long
private final org.apache.http.client.config.RequestConfig
private final String
private final int
private static final String
private final UploadInfo
private final UploadStatus
private CompletableFuture
<UploadResult> private final String
private final String
-
Constructor Summary
ConstructorsConstructorDescriptionFileUpload
(File file, long realmId, int slotId, UploadInfo uploadInfo, User user, String clientVersiob, String worldVersion, UploadStatus uploadStatus) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
private void
cleanup
(org.apache.http.client.methods.HttpPost post, org.apache.http.impl.client.CloseableHttpClient httpClient) private long
getRetryDelaySeconds
(org.apache.http.HttpResponse httpResponse) private void
handleResponse
(org.apache.http.HttpResponse response, UploadResult.Builder uploadResult) boolean
private UploadResult
requestUpload
(int retries) private UploadResult
retryUploadAfter
(long seconds, int retries) private void
setupRequest
(org.apache.http.client.methods.HttpPost post) private boolean
shouldRetry
(long retryDelaySeconds, int retries) void
upload
(Consumer<UploadResult> resultConsumer)
-
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 file, long realmId, int slotId, UploadInfo uploadInfo, User user, String clientVersiob, String worldVersion, UploadStatus uploadStatus)
-
-
Method Details
-
upload
-
cancel
public void cancel() -
requestUpload
- Parameters:
retries
- The number of times this upload has already been attempted
-
cleanup
private void cleanup(org.apache.http.client.methods.HttpPost post, @Nullable org.apache.http.impl.client.CloseableHttpClient httpClient) -
setupRequest
private void setupRequest(org.apache.http.client.methods.HttpPost post) throws FileNotFoundException - Throws:
FileNotFoundException
-
handleResponse
private void handleResponse(org.apache.http.HttpResponse response, UploadResult.Builder uploadResult) throws IOException - Throws:
IOException
-
shouldRetry
private boolean shouldRetry(long retryDelaySeconds, int retries) -
retryUploadAfter
- Throws:
InterruptedException
-
getRetryDelaySeconds
private long getRetryDelaySeconds(org.apache.http.HttpResponse httpResponse) -
isFinished
public boolean isFinished()
-