I want to write a program where I have to download the files of any type in chunk sizes. For example: If the size of file is 2 MB & the server does not allow to download it completely in one request, then I have to download it in suppose 5KB sizes.
It's strange for a server to implement a policy like this, unless it's some kind of hosting service and it's to discourage people from hosting large files. This "chunking" behavior already occurs at a lower level - it's part of the TCP/IP network "stack" to break large files (or any sort of transmission) into manageable smaller packages. You could still implement this at a higher level, but I'm not sure what you would gain from it, unless just as an exercise. What sort of technology were you planning on using?
Unfortunately, "Rahul" does not meet the JavaRanch Naming Policy. User names cannot be obviously fake and must constist of a first name and a last name.