So you want to connect to the internet, start downloading a file and if you lose your connection be able to resume the download after reconnecting? You could do that with plain sockets, but that wouldn't gain you any time because you would still have to skip the bytes already downloaded when you opened up the InputStream the second time. Those skipped bytes are still going to be in the pipe the second time around. So you are most likely going to have to use the FTP protocol and hope that the FTP server supports the RESTART (REST) command. You can find the white paper here
RFC 959 on the full FTP protocol. This is the pertinent statement on the REST command:
RESTART (REST)
The argument field represents the server marker at which
file transfer is to be restarted. This command does not
cause file transfer but skips over the file to the specified
data checkpoint. This command shall be immediately followed
by the appropriate FTP service command which shall cause
file transfer to resume.
Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher