How do I read a remote file ?

Hi,
Suppose the java program on my maching would like to read a file that's located on someone else machine. Do I have to use URLConnection in order to read that file ?
thanks,
Alex

Not necessarily, it depends on how your machine is logically connected to that machine and what servers are running on it.

Similar Messages

  • How do I read a properties file in WEB-INF without hard-coding a path?

    Hello,
    How do I read a properties file in WEB-INF without hard-coding a path?
    I tried:
    Properties properties = new Properties();
    properties.load(new FileInputStream("db.properties"));
    driver = properties.getProperty("driver");
    but it cannot find the db.properties file.
    Thanks for the help.
    Frank

    Don't use a File to read those properties.
    Better to use the servlet context and
    getResourceAsStream() method to get the InputStream.
    It'll look for any file in the CLASSPATH. If you put
    that properties file in the WEB-INF/classes directory
    you'll have no problems, even if you deploy with a
    WAR file.Completely agree with this approach. Just have to mention the following for completeness
    according to the API,
    "This method is different from java.lang.Class.getResourceAsStream, which uses a class loader. This method allows servlet containers to make a resource available to a servlet from any location, without using a class loader. "
    So using this method, the resource can be anywhere under your web context, not just in the classpath.
    Cheers,
    evnafets

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

  • How can I read the bootstrap files and extract the fragment-URLs and fragment-numbers in plain text?

    How can I read the bootstrap files of any HDS Live stream and extract the fragment-URLs and fragment-numbers in plain text?
    Could it be that it is some kind of compressed format in the bootstrap? Can I uncompress it wirh  f4fpackager.exe? Could not find any download for f4fpackager.exe. I would prefere less code to do so. Is there something in Java of JavaScript, that can extract the fragment-numbers?
    Thank you!

    Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
    Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave.

  • How do I read a pdf file in Acrobat Reader (vs. Preview)?

    How do I read a pdf file in Acrobat Reader (vs. Preview)? I have a Mac OS, need to know the process to read a pdf file document in Acrobat Reader instead of Preview. Much thanks for suggestions.

    Right click the PDF. Choose "Open With..." Select Reader.
    Or.
    Right click and "Get Info"
    under "Opens with" change the default app to Reader, and click "Change all" to set the preference for ALL PDFs.

  • How can i read local excel file into internal table in webdynpro for abap a

    Could someone tell me how How can i read local excel file into an internal table in webdynpro for abap application.
    thank u for your reply

    Deep,
    File manuplations...............................
    1. At the presentation level:
    ->GUI_UPLOAD
    ->GUI_DOWNLOAD
    ->CL_GUI_FRONTEND
    2. At the application server level:
    ->OPEN DATASET : open a file in the application server for reading or writing.
    ->READ DATASET : used to read from a file on the application server that has been opened for reading
    -> TRANSFER DATASET : writing data to a file.
    -> CLOSE DATASET : closes the file
    -> DELETE DATASET : delete file
    If file is on the local PC,use the function module GUI_UPLOAD to upload it into an internal table by passing the given parameters......
    call function 'GUI_UPLOAD'
    exporting
    filename = p_file
    filetype = 'ASC'
    has_field_separator = '#'
    tables
    data_tab = t_data
    p_file : excel file path.
    t_data : internal table
    <b>reward points if useful.</b>
    regards,
    Vinod Samuel.

  • How do I Read a .js File from Mime Repository

    How can i read a .js file from Mime Repository,
    Mime Respository is for Re-Usability
    Since i need to call a function from a .js file again and again, i keep my .js file in Mime Repository so that i can call the function anywhere by calling the .js File.
    I have kept my .js File in a Mime Repository but when iam calling the function from Portal the function is not being Triggered, Can i know why it is behaving like that.

    Not required right now.Not resolved

  • How do i read a PDB file on my computer?

    How do i read a PDB file on my computer? Ive downloaded a PDB book and id like to view it directly through my laptop. what software would i need? thks
    Post relates to: Palm TX

    The ebook has been compiled for a specific PalmOS application; without knowing which reader application this file uses, it is impossible to tell whether it can be decompiled and read as a text file. All data files for PalmOS/Garnet have the .pdb file extension.
    Other than the eReader desktop, there are no other desktop ebook reader applications for .pdb files that I am aware of.
    It is usually best to download ebooks in the format (and there are MANY formats) that is appropriate to your usage.
    Post relates to: Palm TX

  • How do I read a winmail file when it is attached to an e-mail?  It doesn't open the right way in Excel on my iMac.

    How do I read a "winmail" file when it is attached to an e-mail?  It doesn't open in Excel on my imac, just code...help! 

    Winmail is for Windows only. Excel does not open emails.
    Ask the sender to send the file in a more up to date format.

  • How can I read the EXCEL file while Program is running in background.

    Hi all Expert,
    How can I read the EXCEL file while Program is running in background.
    Thanks

    you need to place ur excel file on application server and follow this thread: Reading an Excel file from the application server?
    loots of information if you can search forum.. thanks

  • How can I read from a file line by line?

    Hi!
    Could someone post some code or explain how can I read from a file, and want I to read a line each time. How can I go to line number N?
    Thanks

    hi,
    u can try this:
    try     {
          // open text file
          BufferedReader in = new BufferedReader(new FileReader(fileName));
          String line=in.readLine();
          while((line=in.readLine()) != null) {
          System.out.println(line);
          }The go to line number N i m not so sure.
    Cheers
    Jerry

  • How can I read a Excel file?

    How can I read an Excel file and compare if the cells type are numeric or not??
    i hope you can can give me a hand..
    thanks

    If you want to use plsql try utl_file supplied package to read the excel file -> http://psoug.org/reference/utl_file.html
    And you can use a function like this to understand if the column is number or not ;
    CREATE OR REPLACE FUNCTION is_number (
    char_in VARCHAR2)
    RETURN BOOLEAN
    IS
    n NUMBER;
    BEGIN
    n := TO_NUMBER(char_in);
    RETURN TRUE;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN FALSE;
    END is_number;
    DECLARE
    x BOOLEAN;
    BEGIN
    IF is_number('ABC') THEN
    dbms_output.put_line('TRUE');
    ELSE
    dbms_output.put_line('FALSE');
    END IF;
    END;
    /

  • How can I read a binary file?

    In my AIR application, I'm trying to read a binary file and then post it via an HTTPService to a remote ColdFusion component that accepts a "binary" type argument.  The result of the post is always:
    The FILEOBJ argument passed to the addFile function is not of type binary.
    Here is how I'm reading the file in Flex, where fileObj is of type File:
    var fs : FileStream = new FileStream();
    var bytes : ByteArray = new ByteArray();
    fs.open(fileObj, FileMode.READ);
    fs.readBytes(bytes, 0, fs.bytesAvailable);
    fs.close();
    I then pass "bytes" as the parameter to my HTTPService's send call, like so:
    var params : Object = {method : "addFile", fileObject : bytes};
    service.send(params);
    When I debug, bytes contains the correct file size.  Is it not in binary form?  I've tried several other suggestions, but with the same result, so would appreciate any help.
    Thanks!

    One more step...
    short are U16 integer
    double are double precision float
    bool seem to be 2 bytes (= U16)
    char are string (variable length)
    rgb are U16 integer, with high order byte = 0
    rect should be 4 x U16 (top, left, bottom, right)
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How to work with the remote file system

    Hi all,
    I want to know how we can work with the remote file sytem.
    Code should be some thing like
    File f = new File("//10.22.33.122/images")
    images is share name..
    i want the file names of all the images in that shared folder...
    Thanks in advance,
    Srinivas N

    try this one:
    File f = new File("//10.22.33.122/images")
    File[] files = f.listFiles(new FilenameFilter() {
         public boolean accept(File dir, String name)
    // Specify the extentions of files to be included.
         return name.endsWith(".bmp") || name.endsWith(".gif");
    // get names of the files
    String[] fileNamesArray = null;
    for (int indx = 0; indx < files.length(); indx++)
    fileNamesArray[indx] = files[indx].getName();
    return fileNamesArray;

  • How do I read a RIFF file in LabView?

    Hi,
    I want to read data and header information from a RIFF file that is generated by a data recorder. It is saved as a .WAV file, but it contains extra information that I need to read. I have a data sheet that describes where I can find the header information and the data in the .WAV file, but I don't know how to extract it.
    Please help!
    Thanks
    / Patrik

    Hi mrsound,
    There is a VI 'Read from Binary File.vi' in LabVIEW which can read the file as binary data, if you know the exact position where the header information is, you can use it to extract it, just as the attach VI shows. Hope this helps.
    Attachments:
    Read RIFF.vi ‏8 KB

Maybe you are looking for

  • Selection Field in Report Painter Report

    Dear All, Could any one tell me the procedure to add new field at selection screen for the report painter report ? To change the report painter selection screen i have to change the Report group or Report of the report group? Thank in stack

  • Quicktime isn't working

    I had to start my computer with the disc.  I elected to reinstall everything and had my old files put in a previous system folder.  First I couldn't open itunes because it was a older version.  then i copied it from the previous system folder.  Then

  • Error when Broadcasting PDF format to email

    Hi, The template is getting executed properly through WAD. Even, in portal the report is being generated correctly. The problem is when I try to broadcast PDF format to Email. I am receiving the following error when attempting to broadcast a query as

  • Disk utility can't erase my HD

    Hi, I would like to earase my entire hard drive to reboot my macbook pro from zero. Problem is that in Disk Utility the Format dropdown and the Name are grey and wont let me make any changes. Does anybody know how I can slove this? Thanks!

  • Mobile Safari as full desktop safari browser in ipad

    Mobile Safari as full desktop safari browser in iPad I am having a curiosity which i need to solve with the help of yours. Actually as per my knowledge is concerned i know that the iPad is working with the mixture of mobile Safari as regular one. Wha