Using similiar methods as BufferReader for reading files from web

Hello!
I need to read an xml-file in my application. Until now I have used BufferReader-class for that purpose, but the xml-file was located in my hard disk. No I need to get the same file but from the web.
Can anyone, please, give me some simple example for that? I'll give 10 DD for the good hint. :)
-- M

you may find this helpfulBufferedInputStream bis = null;
                    BufferedOutputStream bos = null;
                    try {
                         URL url = new URL(sb.toString());
                         URLConnection urlc = url.openConnection();
                         bis = new BufferedInputStream(urlc.getInputStream());
                         bos = new BufferedOutputStream(new FileOutputStream(destination.getName()));
                         int i;
                         while ((i = bis.read()) != -1) { //read next byte until end of stream
                              bos.write(i);
                         }//next byte
                    } finally {
                         if (bis != null) try { bis.close(); } catch (IOException ioe) { /* ignore*/ }
                         if (bos != null) try { bos.close(); } catch (IOException ioe) { /* ignore*/ }
               }//else: input unavailable
        catch (MalformedURLException e) {
               JOptionPane.showMessageDialog(null,"Internet Failture","Alert ",JOptionPane.PLAIN_MESSAGE);
        catch (IOException ee) {
               JOptionPane.showMessageDialog(null,"Internet Failture","Alert",JOptionPane.PLAIN_MESSAGE);
        }

Similar Messages

  • Using AMP to download and save FLV files from web sites?

    I thought I had heard months ago that this new media player was going to allow you to download and save the FLV files from web sites like YouTube and others, where a direct download while possible, isn't the easiest thing to currently do. But I don't really see any way in this new media player to download and save files from web sites....it's plenty willing to play them if they're already saved on your hard drive, but I thought one of the reasons for Adobe building this was to make it easier to get them in the first place?

    I'd have to agree. This is one of the most useless products I have seen from a company of this standard. Why they continue to provide this product as an example of what can be done with AIR, is bewildering.  Myself and others have posted over and over again that the player deletes the saved movies at some random time, an hour or two hours after they appear to be saved.
    What is the point of having a 'saved' icon the CD ICON if that movie will be deleted   FOR NO BLOODY reason.  I just wasted 400 mb of my quota dowloading moves 3 times...!! just to realise that the application deletes them from the VERY CACHE that it copies them to.
    Adobe, if this is what I can expect while trying to view the tutorials for FLEX what will the development experience be like. Myself and others are fed up with posting this bug to Adobe, just to be ignored. How much stress to do you want on your servers before you WAKE UP.
    I have been in 4 meetings over the last 2 weeks and everyone has remarked about the 'experience' trying to view these tutorials.
    Wake up to yourself. If you want to charge $500 for FLEX then atleast fix this crappy player.
    PS. I note that this player is supposedly built with Flex and that the list control truncates rather than wraps, in addition, no 'tool tips',  dates are not localised, the video keeps unpausing itself each time I return from the downloads page, no settings for where files should be cached. Occasionally the underlining (grey) window bar appears over the top of the flash window edge.  I've used the application for an hour or so...
    Where is the alternative... I'll be glad when Adobe get some real competition.. so that they pay attention to input.  A big wastefull site if all support does is read and ignore posts.!!!!!!!!!!!!

  • I'm trying to use my older Acrobat 4 for printing files from an older Macintosh with system 9, so that I can store and use the pdf documents in a newer MacBook Air, with OSX 10.9.  Acrobat 4 worked previously but no longer works.  Any way to fix it?

    I am trying to transfer older files from a Mac PowerBook G4, running system 9, printing those documents as pdf, using Acrobat 4.  Then those pdf documents will transfer to my newer MacBook Air, running OSX 10, allowing me to store and use them.  My problem is that Acrobat 4 no longer seems to work on the old Mac, and I don't know how to fix it.  Can anyone give me some suggestions?

    You never know, someone might remember. What happens in detail when you try to use it, and HOW are you trying to use it?

  • Read file from presentation server (like GUI_UPLOAD)

    Hi,
    I need to read a txt file from local pc path in CRM WEB UI runtime. The path and the filename are already known, so I don´t need the control provided by thtmlb:fileUpload control, which automatically adds a u2018Browseu2019 button. I need to read this file without any additional controls or buttons.
    I tried with RZL_READ_FILE, but doesn´t work with local files, only with application server files.
    As you all know, GUI_UPLOAD doesn´t work in WEB UI...I need exactly something like that!
    Any help or suggestion wil be appreciated.
    Thanks in advance.
    Federico.

    Hi Federico,
    When it comes to web browser (web ui) file upload cannot be done as it is done in SAP GUI. There is a mechanism called 'Form-based File Upload in HTML' through which file is uploaded from web browser to the server, at the back end this is what is used. So you have to use a fileUpload tag to upload a file from web browser.
    As an alternative solution, you can use Javascript and activexobjects to upload files. I have developed a wiki which explains excel upload using activexobjects and javascript.
    http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebUI-UploadingdatafromExcelfiles
    Regards,
    Arun

  • The Wifi storage options are interesting but it seems they only allow to read files from the device on the iPad but not transfer files to the storage device via WiFi.   I'm looking for a possibility to use the iPad for photography while traveling, without

    the Wifi storage options are interesting but it seems they only allow to read files from the device on the iPad but not transfer files to the storage device via WiFi.
    I'm looking for a possibility to use the iPad for photography while traveling, without the access to a computer.
    Shooting photo's in RAW format crates pretty big files that will fill up the iPad's memory pretty fast if you shoot a lot during a (let's say) month long trip.
    my idea was to use load the photo's to the iPad so i could view them and sort out any bad ones. then copy them over to the storage device so i can continue using my CF cards for shooting. I have an image thank for copying the photo's directly to the HDD but it would be so sweet to be able to check them on the iPad before hand.
    any suggestions?

    Check out pogo plug device, it allows you to upload camera roll via wifi.

  • Important question for reading File

    Good morning
    i need help...
    any one know 1 class for oper all document?
    example:
    http:sitoclient.com/?file?filename.txt
    or
    /home/class/filename.txt
    i need 1 class for open file in all mode
    where is this class?
    one class for read file in url or in absolute path
    Message was edited by:
    mirko81

    ok i know this class but i not know where insert Java.net in my code....
    and i need use class BufferReader for other problem...
    where insert Java.net.URL ??
    String keyCode = "";
    BufferedReader file = new BufferedReader(new FileReader(keyFile));
                   if(file.read() > 0)
                        int i = 0;
                        String appKey = file.readLine();
                        for(i=0;i<500;i++)
                             char c = appKey.charAt(0);
                             if(c==' '| c=='#')
                                  appKey = file.readLine();
                             else
                                  keyCode = keyCode + appKey;
                                  appKey= file.readLine();
                                  char cd = appKey.charAt(0);
                                  if(cd==' '| cd=='#')break;
                   else
                        System.out.println("File corrotto o non presente");
                   }

  • ? How do you change default for .pdf files from Reader 6 to reader 9

    I cannot change the default for .pdf files from reader 6 to reader 9. Also I cannot remove reader 6. I am running Vista

    Normally, completely removing old versions and reinstalling the latest version will reassociate all applicable extensions for the program, but it appears to have failed in your case.  There may be something else going on with your machine that is producing this behavior.  You probably need to investigate that.  But what you can do to make sure the defaults are correct is click on the start orb and select 'Default Programs.'  Then select 'Associate a file type or protocol with a program.'  From the list of file types, select each of the following in turn: acrobatsecuritysettings, fdf, pdf, pdfxml, pdx, xdp, and xfdf.  If its default program is not Adobe Reader, click on the Change Program button and select Acrobat Reader from the list (you may need to expand the lower section to display more programs than it initially provides).  If Adobe Reader does not show up in the list, you will have to browse for it.  It should be located in C:\Program Files\Adobe\Reader 10\Reader\AcroRd32.exe or C:\Program Files (x86)\Adobe\Reader 10\Reader\AcroRd32.exe.
    This method is safer than manually editing the Root\Classes in the registry.

  • Is there any system level support for RAW files from an Olympus XZ-10 camera.  I use Lion and iPhoto version 9.4.2

    Is there any system level support for RAW files from an Olympus XZ-10 camera.  I use Lion and iPhoto version 9.4.2

    If there is I can not find it - Google provides a list of possible methods form Adobe and others
    LN

  • TIFF-VIs for reading/writing from/to files

    To whom it may concern,
    I'm looking for TIFF-VIs for reading/writing from/to files
    for Labview 6 without any add-on package.
    Unfortunately I can't use TiffRd04 and TiffSv05 from
    Koji Ohashi due to the different file format!
    Any hints?
    Thank you in advance. Best regards from Germany
    Udo Weik

    Hi Udo,
    did you check these TIFF related libraries? .. maybe one of them is working.
    Good Luck

  • How can I save adobe reader file from gmail into my adobe reader app?? i would like to open one file in place where I'm not able to access internet and for that reason i would like to save it. is that even possible?

    How can i save adobe reader file from my gmail into my adobe reader application. or is there any other way i can save it into my phone so I'm able to open in any situation not just from my gmail???

    Long hold on the document in mail and it should give you the open in... option, select adobe reader and the file is now saved locally for viewing even while offline.

  • Dynamic Internal Table for reading data from external file

    Hello All,
    The task was to create a internal table with dynamic columns,
    Actually this is my first task in the WebAS 6.20, my program is based on input file provided by user with certain effort. this file can have different effort for a one yr to five year frame..
    I needed to read the raw data from file, based on months create a internal table to hold the data, after this i need to validate the data...
    I have browsed thru dynamic internal table topic, but couldn't find any dynamic appending structure, the dynamic structure would contains 12 month fileds.
    can any one help me in getting my task completed..
    Thanks
    Kumar

    Hi,
    I see that you posted the same question a couple of days ago at Dynamic Internal Table for reading data from external file Didn't Charles's response address your problem?
    Regards

  • Applet read file on web

    Can applet read file on web?
    I try to write an applet that read the file on web i.e. http://lcoalhost:8080/test.txt
    The HTML page contain the applet is placed on http://localhost:8080
    URI URItemp= new URI("file:///test.txt");
    File Filetemp = new File(URItemp);
    BufferReader in = new BufferReader(new InputStreamReader(new FileInputStream(Filetemp)));the above cannot work
    Error : access denied (java.io.FilePermission \test.txt read)
    And then I add
    FilePermission fp = new java.io.FilePermission("file:///test.txt", "read");still cannot work
    Cound anyone tell me that is possible to do what I want to do?
    If yes, how?
    Thanks!!

    Applets are downloaded from web servers and execute on the client machine.
    Therefore they have no access to the web server file system, signed or not.
    They could have access to the client file system (the machine where they run),
    but for security reasons only signed applets have this privilege.
    So to answer your question, you sign if you want to access client files.
    To access web server files, you don't need to sign the applet, but you need
    to provide some method of accessing files remotely, for instance:
    - Files published for the web can be read using HTTP
    - Files can be read or writen with the help of an FTP server on the same machine as the web server
    - A servlet running on the HTTP server can collaborate with your applet to exchange files

  • Reading file from a folder : File dir = new File(URL+aFile_to_add);

    Hi,
    Trying to read files from a dir on my site using a JSP and bean. I've tried nearly every option for the filepath I can think of and it doesn't seem to be finding the file...
    Here's the bit:
    String URL = "images\\wedding_photos\\";
    File dir = new File(URL+aFile_to_add);
    String[] files = dir.list();
    It's working locally, but I obviously had to change the path from c://... to the above.
    The full code is listed below in the addWedding Method
    The method removes the .jpg from the file name and then writes the new file name to a database
    Thanks for any insight.
    Regards
    Jim
    public String addWedding(String aFile_to_add)
    String feedback = "unset in scrubWedding";
    try
    String URL = "images\\wedding_photos\\";
    Class.forName("org.gjt.mm.mysql.Driver");
    java.sql.Connection connection = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/rhwedd2_shop?user=**********&password=*******");
    java.sql.Statement statement = connection.createStatement();
    File dir = new File(URL+aFile_to_add);
    String[] files = dir.list();
    if (files == null)
    feedback = "Sorry, couldn't find the file "+aFile_to_add+"...no files have been added.";
    else
    for (int i=0; i<files.length; i++)
    // Get filename of file or directory
    String filename = files;
    String no_extension;
    //convert string array element into a char array
    char [] charsfilename = filename.toCharArray();
    int newlength = charsfilename.length -4;
    no_extension = String.valueOf(charsfilename,0,newlength);
    filesAdded = filesAdded+", "+no_extension;
    // Show the new file names in stack trace without extension
    //System.out.println("String no_extension " + no_extension );
    statement.executeUpdate("INSERT INTO items VALUES ('"+no_extension+"',5,'"+aFile_to_add+"')");
    // write to table with item_id and weddingid
    feedback = "The following files have been added..."+filesAdded;
    if (statement != null )
    statement.close();
    if ( connection != null )
    connection.close();
    catch(Exception e)
    feedback = "Into the catch";
    e.printStackTrace(System.err) ;
    return feedback;
    }//end addWedding

    String URL = "images\\wedding_photos\\";
    File dir = new File(URL+aFile_to_add); ok, ok, I'll answer...
    1) What gives you the impression that the relative directory "images\\..." exists (or, in other words, what makes you think your current directory is the parent of "images"?

  • Reading files from a mapped drive

    Hello,
    I am trying to pull image files off of a network share in Oracle Forms.
    Everytime I do this, I get error FRM-47109 Cannot locate image file..... i
    have tried accessing this drive with 2 methods:
    1. Button trigger calls with READ_IMAGE_FILE(:datablock.imagelocation ||
    :datablock.filename || '.tif', 'ANY', BLOCK7.IMAGE_ITEM);
    2. Button trigger calls with READ_IMAGE_FILE('\\server\images\'
    ||:CRASH_IMAGES.folder || '\' || :crash_images.docno ||'.tif',
    'ANY', 'BLOCK7.IMAGE_ITEM');
    Both of these calls work on the development side where the T:\ drive is mapped.
    When the form is put on the production server with the same T:\ drive mapping,
    the image is unable to be located.
    I have also found Microsoft article Q122702, which explains how network shares
    are distributed to services. I have edited the registry key
    RestrictNullSessAccess to a value of 0, and remapped the drive using: NET USE
    T: \\server\images /user:Administrator password.
    None of this has worked for me so far, and I have been informed of possible
    issues with forms and mapped network drives. Has anyone seen this before or know of a fix?
    Thanks,
    Jordan

    I'm not too familiar with Windows user accounts.
    I'm having this problem of not being able to read files from a mapped drive.
    Using 10.1.2 Forms Service on a XP machine.
    How do i check to see which user is running the forms service and/or how do I change the settings a user has access to?
    Check in server-info and User/Group: #-1(1)/1, what the heck??
    Thanks.

  • Reading Files from an FTP location based on Timestamp

    Hi,
    I have a requirement of reading files from an FTP location. The files should be read in the order they were saved in the folder. Can someone tell me how to solve this?
    Thanks,
    Ravi

    Hi Arik,
    Thanks for your reply. I tried doing what u said, but it isn't working. My requirement is to List the files in the folder using FTP adapter and get the file name with the least file stamp from the FTP adapter and pass the FileName dynamically to another FTP adapter which reads the file based on the FileName. When i tested after including the property (for listing the files) you mentioned, it is giving the following error (copied from flow trace):
    <messages>
    <input>
    <Invoke_getFileListFTP_FileListing_InputVariable>
    <part name="Empty" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <empty xmlns="http://xmlns.oracle.com/pcbpel/adapter/ftp/APP_SequentialFileTransfer/PRJ_SequentialFileTransfer/WS_GetFileList_FTP"/>
    </part>
    </Invoke_getFileListFTP_FileListing_InputVariable>
    </input>
    <fault>
    <bpelFault>
    <faultType>0</faultType>
    <bindingFault xmlns="http://schemas.oracle.com/bpel/extension">
    <part name="summary">
    <summary>Exception occured when binding was invoked. Exception occured
    during invocation of JCA binding: "JCA Binding execute of
    Reference operation 'FileListing' failed due to: Exception
    occured when binding was invoked. Exception occured during
    invocation of JCA binding: "Could not instantiate
    InteractionSpec
    oracle.tip.adapter.ftp.outbound.FTPListInteractionSpec due
    to: Cannot set JCA WSDL Property. Error while setting JCA
    WSDL Property. Property setListSorter is not defined for
    oracle.tip.adapter.ftp.outbound.FTPListInteractionSpec Please
    verify the spelling of the property. ". The invoked JCA
    adapter raised a resource exception. Please examine the above
    error message carefully to determine a resolution. ". The
    invoked JCA adapter raised a resource exception. Please
    examine the above error message carefully to determine a
    resolution.</summary>
    </part>
    <part name="detail">
    <detail>Cannot set JCA WSDL Property. Error while setting JCA WSDL
    Property. Property setListSorter is not defined for
    oracle.tip.adapter.ftp.outbound.FTPListInteractionSpec Please
    verify the spelling of the property.</detail>
    </part>
    <part name="code">
    <code>null</code>
    </part>
    </bindingFault>
    </bpelFault>
    </fault>
    <faultType>
    <message>0</message>
    </faultType>
    </messages>
    Thanks,
    Ravi
    Edited by: Ravi Santosh on Apr 24, 2012 11:02 PM

Maybe you are looking for

  • Will not display page that is used often...

    Hi. I use rapidshare.com and my home page is blingo.com. Yesterday all was well. I was downloading files, and searching with my home page. Today when I power on the computer my homepage does not load anymore. Neither will rapidshare.com. I have anoth

  • New to Mac.  How to use legacy SCSI devices with MBPro?

    If I have, say... an older external SCSI tape drive, how could I make it work with my new MBPro?

  • Moving entire iTunes library from a windows machine to a mac

    Hi I just bought a mac and I need a way to transfer my entire iTunes library to the mac. I have my mac and pc connected via FTP I was just.wondering if it is as easy as dragging the library folder to the iTunes folder on the mac. Thank You

  • THIS SUCKS!!! Re:Multiple paths in FILE_DATASTORE path attribute

    After 6 hours of struggle I managed to solve my problem. Everything was due to a stupid mistake (or incomplete documentation of intermediaText) on Oracle's part: 1. Pasted from Oracle8i interMedia Text Reference - Datastore Objects: You can specify m

  • 11.1.1.5 - Unable to copy XML to the clipboard

    Could someone do a quick check in 11.1.1.5 and see if you're experiencing this? Click the Catalog link on the common header. Click the More icon for any analysis or KPI. Click Copy. The XML should be on the clipboard, right? Now try to paste into a t