Help! Downloading a file from remote Server


I am currently doing a program for downloading a specified file from the remote server i.e from any website. If the downloading process stops in between due to some problem in the internet connection, then my program needs to start the downloading the file again to the local directory from where it was left.
My idea is that, getting the size of the remote file initially when the downloading process starts and if the connection is interrupted, i will check the size of the downloaded file in the local directory with the remote file size. If the remote file size is greater than the localfile size, i need to start downloading the file where it was left i.e start downloading the next bit from the remote file.
Is there any way to get the contents of the remote file from the specified point say 50th byte from a total file size of 100 kb using java?
which concept to use FtpClient or sockets?
iam a little bit confused!!!!
Please help me.
Thanks in advance.


For HTTP you can use this function to open the stream with offset:
InputStream openStream(URL url, long offset) {
    try {
        URLConnection uc = url.openConnection();
        uc.setRequestProperty("Authorization", "Basic " + (new BASE64Encoder()).encode("username:password".getBytes()));
        if (offset != 0 && url.openConnection().getHeaderField(0).toUpperCase().startsWith("HTTP/1.1"))
            uc.setRequestProperty("Range", "bytes=" + offset + "-");
        return new BufferedInputStream(uc.getInputStream());              
    } catch (MalformedURLException mfURLe) {
        System.err.println("Malformed URL in Client Updater. Unable to receive update list: " + mfURLe.getMessage());
    } catch (IOException ioe) {
        System.err.println("Unable to open input stream: " + ioe.getMessage());
    return null;

October 11, 2015

Help! Downloading a file from remote Server

I am currently doing a program for downloading a specified file from the remote server i.e from any website. If the downloading process stops in between due to some problem in the internet connection, then my program needs to start the downloading th

Help Downloading a file from a server using FTP with only URL methods

Hi All I have written this code and it is not working I dod not know why the download is not working please help is there anything that's missing? * Download the file public void download(String fileName, String destination)        BufferedInputStrea

How to download a file from application server to presentation server

Hi experts, I want to download a file from application server to presentaion server, file contaims three fields customer name, customer email id and status.. help me out i m new into sap.Dear Aditya, Please check below thread

Download text file from application server to client server.

Hi all, I am facing a format issue while downloading text file from application server to the client machine. The issue is that, say I have 6 to 10 lines in my text file in application server. but when i store it on the hard drive, it shoes all the d

Using scp to copy files from remote server to mac from a newbie

Hi am a new poster to this forum and getting (re)acquainted with the unix world using terminal on the Mac. I am part of webteam for a large website run by a nonprofit where I have administrative access. I hope that this forum is the correct venue for

Read XML files from remote server

Post Author: TomDegetel CA Forum: Data Integration This question may look simple to you but I don't see directly how to do this.The idea is to read data from an XML file which is sent to a UNIX directory on a server.When the JobServer is running on m

Downloading file from ftp server

hii how do i download the file from ftp server. plz suggest wat are the function modules for tht.. and plz do give the values of the parameters used in the fn modules points guranteed:-)<i><b>*--> Scramble the password.</b></i>

How to download a file from database

Hi, My flex application contains a form that uploads a file into the server. This file is however saved in the database, and not on the disk. Most of the tutorials in the database explains how to download a file by passing the file's url to the "down

Error occurred while downloading files from Administration Server...

Hi guys, If i already have my application deployed and exploded in ../tmp/_WL_user , when I restart the managed server it will try to download again the files from the upload directory in the Administration Servers? (I'm using stage mode). Sometimes

How to upload and download any file from plsql through weblogic server

hi all, how to upload and download any file from plsql through weblogic server? i am using oracle 10g express edition and jboss. Thanks and Regards, MSORAhi bala , for a windown server u can use VNC (virtual network connection) which opens a session

Need to copy .txt file from FTP server and downloaded on local server directory.

I need to figure out a way to copy .txt file from ftp server in local server directory using sql jobs.Below links will help achieving it:

To access a file from FTP Server

Hi All, I hav a requirement where i have to download a file from an FTP server(Windows based). I'm able to list all the files that are there in the current directory of the FTP server using the command 'LIST'. the required file is present in that lis

Problems in Downloading a file from a web site using HttpClient

Hi, My requirement is to download a file from a website using a java program. I have written a program using HttpClient API but I am unable to do so. Reality is that I don't know how to proceed with the HttpClient API to get the file downloaded. Same

Problem  while reading XML file from Aplication server(Al11)

Hi Experts I am facing a problem while  reading XML file from Aplication server  using open data set. OPEN DATASET v_dsn IN BINARY MODE FOR INPUT. IF sy-subrc <> 0.     EXIT.   ENDIF.   READ DATASET v_dsn INTO v_rec. WHILE sy-subrc <> 0.   END

How to download .doc file from ms sql

Hi guys.,,,! I have a problem in file uploading and downloading. The problem is i upload my .doc file in ms sql server successfully completed. After that i would like to download the file from the database.can anybody tell that how to download the fi

Problems with downloading music files from particular websites

Has anyone else had problems using the Calabash or Afropop websites to download music files? I am able to download using Tiger on my MacBook Pro but each time I try the same with Leopard on my iMac, I get a message that the file does not exist. Howev

Issues opening downloaded docx files from the internet on my mac air...

I have owned my Mac Air for nearly 1.5 yrs and never had an issue, until yestrday. I can download docx files from the internet no problem, but when I go to open them (after they have saved into my downloads folder) a pop-up window with "convert file

FM to read XML files from Application server in ECC5.0

Hi All, We need to pick up an XML file from Application server/FTP server. The requirement is to parse the XML file and process it to create material master. SAP provides standard function modules to read XML files. Now we need to read the XML file c

Load Flat File from App Server

HI, all. I want load flat file from appliation server. I created CSV file and loaded it on app. server with FM ARCHIVEFILE_CLIENT_TO_SERVER. After I created datasource and tried load data in the infocube. In this procedure I encountered with two prob

Problem during retriving file from application Server

Hi all, i am trying to upload a world file (from desktop ) on application server and retrieve it back on local desktop. during retrieval of file from application server i am getting all the data in encoded format . i am using - open DATASET p_fpath f