0

I have a Web service based on XML-RPC ,I tried to download a large data using this method :

byte[] data = request.getInfo(infoFilter).getDocuments().get(indexDocument).getContent(); 

When the data is considered as big, the application will cause exception of out of memory ,because some device has a small size cache ,my solution here is to truncate the data in small quantity. I think I need to get inspiref from this code :

FileOutputStream fos = new FileOutputStream(file);
while ((current = bis.read()) != -1) {
    fos.write(current);
}
fos.close();

Can anyone has an idea about how can i resolve this issue ?

Amira Bedhiafi
  • 8,088
  • 6
  • 24
  • 60
Sofien Rahmouni
  • 4,354
  • 1
  • 21
  • 22
  • What is `request` ? is this an object from a 3rd pary lib or do you have full source code control over this class ? – PeterMmm Jan 26 '15 at 14:38
  • is the part of 3rd library , i dont have a full source code control – Sofien Rahmouni Jan 26 '15 at 14:38
  • If there is no special parameter or similiar control for `getContent()` to limit the amount per request, I think you are out of luck. Could you write your own XML-RPC for a specific case ? – PeterMmm Jan 26 '15 at 14:43
  • Look here :http://stackoverflow.com/questions/27549232/outofmemory-recycle-images/27555881#27555881 – Josef Jan 26 '15 at 14:44
  • @PeterMmm i have a flags to activate the download of data or not , but a special parameter to to limit the amount per request dosent exist , i will talk the creator of the library to give me another way to download the data per amount . thanks Peter – Sofien Rahmouni Jan 26 '15 at 15:08

0 Answers0