public static List < Pair < String , String > > loadPropertyFile ( String filename , Plugin bundledPlugin , Class < ? > readerClass , Function1 < IOException , IStatus > statusBuilder ) { final URL url ; if ( bundledPlugin != null ) { url = FileLocator . find ( bundledPlugin . getBundle ( ) , Path . fromPortableString ( filename ) , null ) ; } else { url = readerClass . getClassLoader ( ) . getResource ( filename ) ; } if ( url == null ) { return Lists . newArrayList ( ) ; } final OrderedProperties properties = new OrderedProperties ( ) ; try ( InputStream is = url . openStream ( ) ) { properties . load ( is ) ; } catch ( IOException exception ) { if ( bundledPlugin != null ) { bundledPlugin . getLog ( ) . log ( statusBuilder . apply ( exception ) ) ; } else { throw new RuntimeException ( exception ) ; } } return properties . getOrderedProperties ( ) ; }
Load a property file from the resources . This function is able to get the resource from an OSGi bundles if it is specified or from the application classpath .