I use range hader, but not create correct file.
if I send Range bytes=0-8999
file weighs 9000 bytes and correct work.
if I send Range bytes=0-8999,9000-9999
file weighs 10213 bytes and NOT correct work.
File type mp3.
What could be wrong?
HttpGet first = new HttpGet("http://cs4832.vkontakte.ru/u50184979/audio/ef64581d913c.mp3");
first.addHeader("Accept-Ranges", "bytes");
first.addHeader("Range", "bytes=0-8999,9000-9999");
//first.addHeader("Accept-Ranges", "bytes");
HttpResponse response = httpclient.execute(first, localContext);
InputStream instream = response.getEntity().getContent();
File f = new File("outFile1.mp3");
OutputStream out = new FileOutputStream(f);
byte buf[] = new byte[1024];
int len;
while ((len = instream.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.close();
instream.close();