Saving a file from a website to the local drive

From New To Java thread - nobody knew the answer, i guess! :(
Hi people,
I have a number of URLs at hand that point to certain class files, e.g.
http://www.mywebsite.com/classes/MyClass.class
What i would like to do is to download MyClass.class into a temporary folder (or wherever) on the local disk. Does anyone know how to do this? I've read about HttpURLConnection etc., but its all very confusing!
Cheers,
JG

u can do
URL url = new URL("http://www.mywebsite.com/classes/MyClass.class");
InputStream in = url.openStream();
then do a loop of reading the bytes in, and writing them out to some FileOutputStream
asjf

Similar Messages

  • How to download a clob file from a table to my local drive?

    Hii Everyone,
    I'm havig a table of this structure
    Create table r_dummy
    c_clob_file clob
    How to download this file into my local drive?Please give me some hints.Can this be done using dbms_lob??
    Regards
    Raghu.

    You need to share a directory on your local drive and give permissions for the database server to write a file on your local drive. Or you may create the file on your database server and copy the same to your local drive.
    conn / as sysdba
    create or replace directory ext_tab_dir as 'C:\ExtTab_Dir';
    /* you may need to give a network path in place of C:\ExtTab_Dir if you want to create the file on your local drive. The directory should be created manually by you on the file system*/
    grant read, write on directory ext_tab_dir to scott;
    conn scott/tiger
    declare
            clb clob;
            l_output utl_file.file_type;
            len integer(6);
            vstart integer(6):=1;
            bytelen integer(6):=32000;
            my_vr varchar2(32000);
            x integer(6);
    begin
             l_output := utl_file.fopen('EXT_TAB_DIR','Clob_File.txt','w',32767);
            select c_clob_file into clb
             from r_dummy;
             len:=dbms_lob.getlength(clb);
             x:=len;
            while vstart < len and bytelen > 0
            loop
                dbms_lob.read(clb,bytelen,vstart,my_vr);
                utl_file.put(l_output,my_vr);
                utl_file.fflush(l_output);
                vstart:=vstart+bytelen;
                x:=x-bytelen;
                if x< 32000 then
                   bytelen := x;
                end if;
            end loop;
            utl_file.fclose(l_output);
    exception when others then
            utl_file.fclose(l_output);
            raise;
    end;
    /Edited by: Preta on Sep 29, 2010 10:53 AM

  • Files wont copy from Server via AFP to local Drive

    Hi All,
    I'm having trouble copying iMovie project files from an xServe to a local drive. I'm running Mac OS X 10.4.9, and what happenes is when I open the mount and find the file, I drag it accross the the users home folder-> movies folder and copy it. Problem is the source file is 3.14 gigs, and when it copys it copys a file thats 997KB is size, everytime and says its done sucsessfully. Obviously the file wont open.
    Can anyone Help?

    I guess your having some permisssions lingo. iMovie projects are folders that are presented by the Finder as if it were files.
    HTH
    -Ralph

  • Saving files from a website

    Previously, when I saved a PDF from a website, it goes to the last subdirectory location. However, with Acrobat Reader 9, it goes to the root directory. Any help so that I could go to the last subdirectory? Thanks,

    In your image you are telling the function to create a file and the path to the file is a folder, that I assume is existing.  You must provide the full path including the file name to the Open/Create function.
    It would be helpful if you posted what the error you got was as well to make sure this is what is happening.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Using Firefox 3.6.20 and Windows XP Home SP3. Firefox sporatically deletes bookmarks from the bookmarks toolbar. Additionally, when I try to import from a saved HTML file, Firefox does not import the complete file. Results are inconsistent.

    Using Firefox 3.6.20 and Windows XP Home SP3. Firefox sporatically deletes bookmarks from the bookmarks toolbar. Additionally, when I try to import from a saved HTML file, Firefox does not import the complete file. Results are inconsistent.

    A possible cause is a problem with the file places.sqlite that stores the bookmarks and the history.
    *http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox

  • Can I save pdf files from a website to ipad2?

    Can I save pdf files from a website to ipad2?

    Tgara wrote:
    Johnathan Burger wrote:
    Yes.
    Hit the link for the PDF-you will be given option to open in safari or iBooks(or any other program able o open PDFs).
    That's not what she asked about.  She asked about saving PDFs, not just opening them and reading them.  While Safari lets you open PDF documents, it does not let you save them.  In order to save them, you'll need to use a web browser that permits downloading.  I use Atomic Web Browser and can confirm that it does permit downloading and saving of PDF documents.
    http://itunes.apple.com/us/app/atomic-web-browser/id347929410?mt=8
    When you open a pdf in iBooks, it's automatially saved there.

  • How to link individual picker view selections to download an individual file from a website or other location such as dropbox using Xcode?

    Alright, the question I have has to deal with how to link an app to a website to download files. How, or is it even possible to link individual picker view selections to download an individual file from a website or other location such as dropbox using xcode. Sorry if this is the wrong place to post this, but if anyone can help or can send a link to a place that can, I would greatly appreciate it!

    I am not getting anywhere with deploying my application or
    applet.
    I have set up my bc4j project. It contains all my VO info,
    links, application module. (proj a)
    I then have another project with DbInfo in it(has all my rowset
    info), Multiple Frames, and my Applet.java file.
    Actually I have an Applet.java file and a Application.java file
    because I was seeing if both/either worked. Anyway they seem the
    same, except for that extra window that comes up when you run the
    applet.
    I follow the steps in the oracle directions (from earlier post).
    And all seems ok. But at ---->
    [*] Select the subdirectory under myhtml where your applet's HTML
    file
    is located, and enter the directory path of the 'staging'
    directory you
    created in step 3 above, if different from the default.</li>
    [*]Select the HTML files that JDeveloper created to run your
    applet.</li>
    [*]Select all of the Java source files in your project that make
    up the
    applet.</li>
    I have no HTML file associated with my applet, at least that I
    know of.
    So do I need to create one, or should it of been done
    automatically.
    Also, I trying to figure out what will be the best way to deploy
    my project. Applet or stand alone application is what my first
    choices have been so far. I have read that there is some issues
    with applets being served from a different server than the
    database. So a stand alone application was my front runner, but
    I haven't gotten either way to work yet.

  • Firefox freezes when opening an adobe acrobat (PDF) file from any website

    Firefox freezes when opening an adobe acrobat (PDF) file from any website. This only started happening after the latest update of Firefox was installed. Do you have a fix?

    Hi Susan,
    The Adobe plugin in Internet Explorer is a bit different from the one in Firefox, however they're all made by Adobe and they usually come with Adobe Reader.
    When you open a PDF file in Firefox, it "calls" Adobe Reader to help it read the file. In this case, the Adobe Reader takes over, and it is responsible for freezing your browser.
    I suggest you try the last 4 solutions presented on the [[Opening PDF files within Firefox]] (start with "Re-install the plugin" through "Re-install Adobe Reader").
    Good Luck :D

  • How do I open an xlsx file from a website rather than downloading it?

    When I try to open an .xlsx file from a website, it downloads and does not open. Before the last update, it would just open the file. How do I get it to open when I click on it rather than just download it?

    Thanks for the suggestion. Unfortunately, that didn't work...it still just downloads it to the temp file and doesn't open. Any other ideas? It worked before the last update of Firefox.

  • Cannot download files from certain websites: log-in prompt

    Hi, I am for some reason getting a log-in prompt when clicking on downloadable files from certain websites (pdf files, etc.). It is especially strange because it is happening on multiple sites, which gave me no problem downloading in the past. This is particular to my computer, and it is happening in different locations, so it can't be a problem with my isp or something.
    I am getting this prompt:
    "To view this page, you need to log in to area "PAGE TITLE" on "www.address.com:80"
    Your password will be sent in the clear."
    (Where PAGE TITLE and address.com are specific to the page I'm trying to access)
    I've tried giving a username and password, but it didn't work. I tried emptying my cache and deleting cookies, renewing my ip address, to no avail. I do not use any proxies, so I am really confused now.
    I've found no documentation of anyone else having this issue.
    Any help would be appreciated!

    i figured it out... it was just a strange coincidence, nothing wrong after all.

  • Why aren't all view options available when saving a file from Adobe InDesign CC 2014 on OS X Yosemite?

    Why aren't all view options available when saving a file from Adobe InDesign CC 2014 on OS X Yosemite?

    ASk in the ID forum and explain better what you actually mean.
    Mylenium

  • How to pick a file from a website

    Hi All,
    I have a requirement like this. I need to pick a file from a website for which i have the link and the file name . Its a .csv file. can i use file adapter to pick that file? can i mention the http link in the source directory field?  or suggest me some way to pick that file . Its a website not a web service.
    reagrds
    jhansi

    HI Hema,
    A work around i see is to use run operating system command before message processing option in sender file adapter.
    Here I'd write a  .bat file which which will execute a java class..
    Basically I'll write a java class to download the file from the URL and keep it. And this file will be picked up by XI.
    May be the same thing can also be achieved using scripts but i have no idea on dat...
    Any how, my java code segment wud be something like
              try {
                      String webFile =
                         "http://www.dilbert.com/comics/dilbert/archive/images/dilbert2002222271107.gif";
                      URL url = new URL(webFile);
                      InputStream is = url.openStream();
                      FileOutputStream fos=new FileOutputStream("C://MyFolder//dilbert2002222271107.gif");
                      int oneChar;
                        while ((oneChar=is.read()) != -1)
                           fos.write(oneChar);                     
                        is.close();
                        fos.close();               
              } catch (Exception e) {
                   // TODO: handle exception
                   e.printStackTrace();

  • Corrupted content error when trying to download .pdf file from one website.

    Unable to download .pdf file from a website, but IE8 provided the download without hesitation.
    Both v7 and v8 produced the same message:
    "Corrupted content error"
    The page you are trying to view cannot be shown because an error in the data transmission was detected.
    This may be a particular website problem, or it may be common to the particular industry segment and their protocols.
    I have followed the help leads and examined the profile for Firefox as used in this instance. Nothing untoward seemed to pop out as a causal factor.

    Reworked some of the javascript for our webserver and fixed the problem.

  • I have installed itunes 11.0.2.26. When I delete a file or podcast I am not being prompted to delete the file from its folder at the same time.

    I have installed itunes 11.0.2.26. When I delete a file or podcast I am not being prompted to delete the file from its folder at the same time. How do I restore this facility? I am running a 64bit Windows 7 OS

    Is the media files in question in the iTunes library or elsewhere on the computer?

  • Delete  flat file from the local drive after downloading in the program

    how to <b>delete flat file from the local drive after downloading in the program</b>
    I am using gui_upload to upload flat file data in internal table. and after that i dont want that flat file in the disk. i want to delete it.

    Once the file has been uploaded into the internal table call the<b> FILE_DELETE </b>method of the class  <b>CL_GUI_FRONTEND_SERVICES</b>.
    DATA: v_rc TYPE i.
    CALL METHOD cl_gui_frontend_services=>file_delete
    EXPORTING
    filename = 'C:\TEMP\MATERIAL.TXT'
    CHANGING
    rc = v_rc
    EXCEPTIONS
    file_delete_failed = 1
    cntl_error = 2
    error_no_gui = 3
    file_not_found = 4
    access_denied = 5
    unknown_error = 6
    OTHERS = 7.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Regards
    Kathirvel

Maybe you are looking for

  • What kind of security cable do I need to purchsare for a MacBook Pro with Retina Display?

    Looking to purchase a security cable for a MacBook Pro, any suggestions?

  • List using pl/sql

    Hi Experts, I am trying to create DHTML Expanding list from the database table using pl/sql code. For this I am putting below code in current list entry tab in list. declare v_cnt pls_integer := 0; begin htp.prn('<ul class="my_list">'); for i in (sel

  • DTW Error

    SAP 8.81. I imported the Business Partners. Now I want to import the BP Banks OCRB. When I run the DTW get error that the CardCode in the OCRB file is invalid. I try with just one record so I know that the CardCode is correct Any suggestions

  • Infotype for Dependents data

    Hi Experts, We need to store additional data of Dependents in an infotype other than 0021. Please let me know if there is any international infotype where we can store dependents data. We don't want to add custom fields to the standard infotype 0021.

  • Where did my folders of tabs go

    Before I downloaded the new beta I had my bookmarks in folders underneath the search bar. There were other websites on their own up there too. They were in a row like the stumble-upon bar. Now they're not there and I can't drag the tab down to make a