protected static Map < String , Integer > loadMonthAliases ( String file ) throws IOException { InputStream in = DateParser . class . getClassLoader ( ) . getResourceAsStream ( file ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( in ) ) ; Map < String , Integer > map = new HashMap <> ( ) ; String line ; int month = 1 ; while ( ( line = reader . readLine ( ) ) != null ) { for ( String alias : line . split ( "," ) ) { map . put ( alias , month ) ; } month ++ ; } reader . close ( ) ; return map ; }
Loads month aliases from the given resource file