RequestHeader help

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

RequestHeader help

Postby sukitha » Thu May 28, 2009 5:59 am

This is a snip of my code



Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. URL sourceURL = new URL(urlStr);
  3.  
  4. URLConnection con = sourceURL.openConnection();
  5.  
  6. con.setRequestProperty("Content-Range", "bytes 0-200/"+pbMax); //sets
  7.  
  8. a chunck to download
  9.  
  10. InputStream inStream=(InputStream)con.getContent();
  11.  
  12. int pbMax =con.getContentLength();
  13.  
  14. Log.w("TAG",""+pbMax); //but  this returns the full length
  15.  
  16.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4



THis downloads the full content even if i set a part to download.
Please have a look
Thank you
Sukitha Udugamasooriya
Colombo - SL
sukitha
Freshman
Freshman
 
Posts: 3
Joined: Wed May 27, 2009 8:59 am

Top

Found the solution

Postby sukitha » Thu May 28, 2009 12:00 pm

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. con.setRequestProperty("Range", "bytes=" + currentProgress+ "-");
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
Sukitha Udugamasooriya
Colombo - SL
sukitha
Freshman
Freshman
 
Posts: 3
Joined: Wed May 27, 2009 8:59 am

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 7 guests