Fixed issue with to large ftp upload size
This commit is contained in:
parent
ba73aab706
commit
c42b8fd3d5
2 changed files with 19 additions and 10 deletions
1
.idea/modules/app/app.iml
generated
1
.idea/modules/app/app.iml
generated
|
|
@ -78,6 +78,7 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/../../../app/src/test/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../../app/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../../app/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../../app/build/intermediates/builds" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../../app/build/intermediates/bundles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../../app/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../../app/build/intermediates/classes-proguard" />
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import java.util.regex.Pattern;
|
|||
*/
|
||||
public class UeBehaviourFtpUpload extends UeBehaviourFtp {
|
||||
private static final Logger log = Logger.getLogger(UeBehaviourFtpUpload.class);
|
||||
private static final int BUFFER_SIZE = 512;
|
||||
private static final int BUFFER_SIZE = 8192;
|
||||
|
||||
|
||||
@Configurable(order=1, value="Host")
|
||||
|
|
@ -38,8 +38,8 @@ public class UeBehaviourFtpUpload extends UeBehaviourFtp {
|
|||
if (outStream != null) {
|
||||
OutputStream out = new BufferedOutputStream(outStream);
|
||||
|
||||
if(sizeOrFile != null && Pattern.matches("\\d*", sizeOrFile)){
|
||||
int size = Integer.parseInt(sizeOrFile);
|
||||
if(isLong(sizeOrFile)){
|
||||
long size = Long.parseLong(sizeOrFile);
|
||||
uploadRandomData(out, size);
|
||||
}
|
||||
else{
|
||||
|
|
@ -55,13 +55,13 @@ public class UeBehaviourFtpUpload extends UeBehaviourFtp {
|
|||
}
|
||||
}
|
||||
|
||||
private void uploadRandomData(OutputStream out, int size) throws IOException {
|
||||
private void uploadRandomData(OutputStream out, long size) throws IOException {
|
||||
// Upload data
|
||||
log.debug("Uploading random data with size "+size);
|
||||
int total = 0;
|
||||
long total = 0;
|
||||
byte[] data = new byte[BUFFER_SIZE];
|
||||
while (total < size && !stopExecution()) {
|
||||
int writeLength = (total + data.length < size ? data.length : size - total);
|
||||
int writeLength = (int)(total + data.length < size ? data.length : size - total);
|
||||
out.write(data, 0, writeLength);
|
||||
|
||||
total += writeLength;
|
||||
|
|
@ -109,11 +109,19 @@ public class UeBehaviourFtpUpload extends UeBehaviourFtp {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
if(sizeOrFile != null && Pattern.matches("\\d*", sizeOrFile)){
|
||||
int size = Integer.parseInt(sizeOrFile);
|
||||
return "Will upload "+ StringUtil.getByteString(size) +" of random data.";
|
||||
if (sizeOrFile != null) {
|
||||
if (isLong(sizeOrFile)) {
|
||||
long size = Long.parseLong(sizeOrFile);
|
||||
return "Will upload " + StringUtil.getByteString(size) + " of random data.";
|
||||
}
|
||||
else
|
||||
return "Will upload local file " + sizeOrFile;
|
||||
}
|
||||
return "Will upload local file "+ sizeOrFile;
|
||||
else
|
||||
return "No file specified";
|
||||
}
|
||||
|
||||
private boolean isLong(String str){
|
||||
return sizeOrFile != null && Pattern.matches("\\d{1,19}", str);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue