mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 14:22:05 +01:00
http-file-upload: make order of parameters more logical
This commit is contained in:
parent
e2d393d00d
commit
10aee6c787
1 changed files with 3 additions and 4 deletions
|
@ -264,7 +264,7 @@ public final class HttpFileUploadManager extends Manager {
|
||||||
final long fileSize = file.length();
|
final long fileSize = file.length();
|
||||||
// Construct the FileInputStream first to make sure we can actually read the file.
|
// Construct the FileInputStream first to make sure we can actually read the file.
|
||||||
final FileInputStream fis = new FileInputStream(file);
|
final FileInputStream fis = new FileInputStream(file);
|
||||||
upload(listener, fileSize, fis, slot);
|
upload(fis, fileSize, slot, listener);
|
||||||
return slot.getGetUrl();
|
return slot.getGetUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ public final class HttpFileUploadManager extends Manager {
|
||||||
Objects.requireNonNull(fileName, "Filename Stream cannot be null");
|
Objects.requireNonNull(fileName, "Filename Stream cannot be null");
|
||||||
Objects.requireNonNull(fileSize, "Filesize Stream cannot be null");
|
Objects.requireNonNull(fileSize, "Filesize Stream cannot be null");
|
||||||
final Slot slot = requestSlot(fileName, fileSize, "application/octet-stream");
|
final Slot slot = requestSlot(fileName, fileSize, "application/octet-stream");
|
||||||
upload(listener, fileSize, inputStream, slot);
|
upload(inputStream, fileSize, slot, listener);
|
||||||
return slot.getGetUrl();
|
return slot.getGetUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,8 +431,7 @@ public final class HttpFileUploadManager extends Manager {
|
||||||
setTlsContext(sslContext);
|
setTlsContext(sslContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void upload(UploadProgressListener listener, long fileSize, InputStream iStream, Slot slot) throws IOException {
|
private void upload(InputStream iStream, long fileSize, Slot slot, UploadProgressListener listener) throws IOException {
|
||||||
|
|
||||||
final URL putUrl = slot.getPutUrl();
|
final URL putUrl = slot.getPutUrl();
|
||||||
|
|
||||||
final HttpURLConnection urlConnection = (HttpURLConnection) putUrl.openConnection();
|
final HttpURLConnection urlConnection = (HttpURLConnection) putUrl.openConnection();
|
||||||
|
|
Loading…
Reference in a new issue