我選擇了一個基本的解決方案:通過「for」連接和斷開詢問位和字節到ws。考慮到最後要提出的部分應該很好地計算出來(numberBytes)。
FileOutputStream fos = new FileOutputStream(file,true); //Important that 'true'.
int numberBytes = 1024; //if numberBytes < 'sizefile' then = sizefile
int numberPart = 0; //
int parts = sizefile/numberBytes; // if the result is decimal must add +1
for(int b=0;b<parts;b++){
//Calculate the part to be ordered: 0...numberBytes+1 ...n+1 ...n+1
numberPart = functionCalculate(numberBytes,sizefile,b);
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo p1 = new PropertyInfo();
pi.setName("part");
pi.setValue(numberPart);
pi.setType(int.class);
Request.addProperty(p1);
PropertyInfo p2 = new PropertyInfo();
p2.setName("bytess");
p2.setValue(numberBytes);
p2.setType(int.class);
Request.addProperty(p2);
Blah blah ksoap code…
Blah blah ksoap code…
try{
Blah blah ksoap code…
Blah blah ksoap code…
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
bytes = response.toString().getBytes(「UTF-8」);
fos.write(bytes,0,bytes.length);//It is a zip. no need to build a zip
}catch(...
}//end for
close fos