private InputStream openCustomSortOrderFile ( ) throws FileNotFoundException { InputStream inputStream ; try { inputStream = new FileInputStream ( customSortOrderFile ) ; } catch ( FileNotFoundException ex ) { // try classpath try { URL resource = this . getClass ( ) . getClassLoader ( ) . getResource ( customSortOrderFile ) ; if ( resource == null ) { throw new IOException ( "Cannot find resource" ) ; } inputStream = resource . openStream ( ) ; } catch ( IOException e1 ) { throw new FileNotFoundException ( String . format ( "Could not find %s or %s in classpath" , new File ( customSortOrderFile ) . getAbsolutePath ( ) , customSortOrderFile ) ) ; } } return inputStream ; }
Load custom sort order file from absolute or class path .