private static void processResource ( String resourceName , AbstractProcessor processor ) { InputStream lastNameStream = NameDbUsa . class . getClassLoader ( ) . getResourceAsStream ( resourceName ) ; BufferedReader lastNameReader = new BufferedReader ( new InputStreamReader ( lastNameStream ) ) ; try { int index = 0 ; while ( lastNameReader . ready ( ) ) { String line = lastNameReader . readLine ( ) ; processor . processLine ( line , index ++ ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Processes a given resource using provided closure