Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Reading Property File

  1. #1
    Join Date
    Nov 2007
    Posts
    18

    Question Reading Property File

    Can I reading Property file using Spoon or Java Script Code

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    I've seen several people do it with javascript to set variables... define 1 big line in a text file input. Process that line with javascript, splitting on '=' e.g. and doing whatever you can do with it.

    Regards,
    Sven

  3. #3
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    JavaScript example:

    Code:
    java;
    
    var p = new java.util.Properties();
    var fis = new java.io.FileInputStream("/home/matt/.kettle/kettle.properties");
    p.load(fis);
    fis.close();
    
    var nrRows = p.getProperty("NR_OF_ROWS");

  4. #4
    Join Date
    Nov 2007
    Posts
    18

    Question Memory Issue

    Ok but in this way each time i need to reading from Property file will load all keys and values in memory

  5. #5
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Not really:

    Code:
    java;
    
    var p;
    
    if (p==null)
    {
     p = new java.util.Properties();
     var fis = new java.io.FileInputStream("/home/matt/.kettle/kettle.properties");
     p.load(fis);
     fis.close();
    }
    
    var nrRows = p.getProperty("NR_OF_ROWS");
    Do whatever you want with it.

  6. #6
    Join Date
    Nov 2007
    Posts
    18

    Smile Thanks

    Thank you very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.