Results 1 to 3 of 3
  1. #1
    samaravadhi is offline Member
    Join Date
    Sep 2011
    Posts
    5
    Rep Power
    0

    Default getResourceAsStream

    can you help me which method should i used to load all the files from a directory instead of one file. i need all files to be loaded

    InputStream is1 = Compare.class.getResourceAsStream(F1);
    Properties prop = new Properties();
    prop.load(is1);

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,967
    Rep Power
    19

    Default Re: getResourceAsStream

    You would probably need to create a File object representing the directory and then use whatever the method is that lists the files in it...possibly called listFiles().

    Unless this is in a jar file?

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,335
    Rep Power
    25

    Default Re: getResourceAsStream

    load all the files from a directory instead of one file.
    Are you asking how to use the Properties class's load method to read all of the files in a directory (all properties files I assume) and merge them into one instance of the Properties class?
    One way to do it would be to extend the InputStream class and have that class read the contents of all the files and return them to the load() method.

Similar Threads

  1. Replies: 26
    Last Post: 05-31-2010, 09:05 PM
  2. Replies: 2
    Last Post: 05-31-2009, 05:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •