Package net.minecraft.client.realms
Class FileUpload
java.lang.Object
net.minecraft.client.realms.FileUpload
@Environment(CLIENT) public class FileUpload extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
FileUpload.CustomInputStreamEntity
-
Field Summary
Fields Modifier and Type Field Description private AtomicBoolean
cancelled
private String
clientVersion
private File
file
private static Logger
LOGGER
private org.apache.http.client.config.RequestConfig
requestConfig
private String
sessionId
private int
slotId
private UploadInfo
uploadInfo
private UploadStatus
uploadStatus
private CompletableFuture<UploadResult>
uploadTask
private String
username
private long
worldId
-
Constructor Summary
Constructors Constructor Description FileUpload(File file, long worldId, int slotId, UploadInfo uploadInfo, Session session, String clientVersion, UploadStatus uploadStatus)
-
Method Summary
Modifier and Type Method Description void
cancel()
private void
cleanup(org.apache.http.client.methods.HttpPost request, org.apache.http.impl.client.CloseableHttpClient client)
private long
getRetryDelaySeconds(org.apache.http.HttpResponse response)
private void
handleResponse(org.apache.http.HttpResponse response, UploadResult.Builder uploadResultBuilder)
boolean
isFinished()
private UploadResult
requestUpload(int currentAttempt)
private UploadResult
retryUploadAfter(long retryDelaySeconds, int currentAttempt)
private void
setupRequest(org.apache.http.client.methods.HttpPost request)
private boolean
shouldRetry(long retryDelaySeconds, int currentAttempt)
void
upload(Consumer<UploadResult> callback)
-
Field Details
-
LOGGER
-
file
-
worldId
private final long worldId -
slotId
private final int slotId -
uploadInfo
-
sessionId
-
username
-
clientVersion
-
uploadStatus
-
cancelled
-
uploadTask
-
requestConfig
private final org.apache.http.client.config.RequestConfig requestConfig
-
-
Constructor Details
-
FileUpload
public FileUpload(File file, long worldId, int slotId, UploadInfo uploadInfo, Session session, String clientVersion, UploadStatus uploadStatus)
-
-
Method Details
-
upload
-
cancel
public void cancel() -
requestUpload
-
cleanup
private void cleanup(org.apache.http.client.methods.HttpPost request, org.apache.http.impl.client.CloseableHttpClient client) -
setupRequest
private void setupRequest(org.apache.http.client.methods.HttpPost request) throws FileNotFoundException- Throws:
FileNotFoundException
-
handleResponse
private void handleResponse(org.apache.http.HttpResponse response, UploadResult.Builder uploadResultBuilder) throws IOException- Throws:
IOException
-
shouldRetry
private boolean shouldRetry(long retryDelaySeconds, int currentAttempt) -
retryUploadAfter
private UploadResult retryUploadAfter(long retryDelaySeconds, int currentAttempt) throws InterruptedException- Throws:
InterruptedException
-
getRetryDelaySeconds
private long getRetryDelaySeconds(org.apache.http.HttpResponse response) -
isFinished
public boolean isFinished()
-