public synchronized Properties getProperties ( final File file ) throws IOException { final Properties fileprops ; if ( needsReload ( file ) ) { fileprops = new Properties ( ) ; final InputStream is = new FileInputStream ( file ) ; try { fileprops . load ( is ) ; } finally { if ( null != is ) { is . close ( ) ; } } mtimes . put ( file , file . lastModified ( ) ) ; props . put ( file , fileprops ) ; return fileprops ; } return props . get ( file ) ; }
Get the java Properties stored in the file loading from disk only if the file has been modified since the last read or the cached data has been invalidated .