View Single Post
  #1 (permalink)  
Old 07-30-2007, 03:24 PM
leonard leonard is offline
Member
 
Join Date: Jul 2007
Posts: 43
leonard is on a distinguished road
how to download using java
I'm trying to download a file using a java program.
I want to send the range of bytes which I want to retrieve from the particular url.
In the code I want to download the bytes from 100 to 150 and the file's size is of 500 bytes
is the code correct?
Code:
URL url=new URL("exampleurl"; URLConnection conn=url.openConnection(); conn.setRequestProperty("Accept-Ranges","bytes"); conn.setRequestProperty("Content-Range","bytes 100-150/500"); dis = new DataInputStream(con1.getInputStream()); message=dis .readLine(); while(!message.equals(" ") ) { System.out.println(message); message=dis .readLine(); }
thanks
Reply With Quote
Sponsored Links