private static byte [ ] getData ( String fileName , Object location ) throws IOException { byte [ ] data ; if ( location instanceof String ) { data = FileSupport . getBinaryFromJar ( fileName , ( String ) location ) ; } else if ( location instanceof File ) { InputStream in = new FileInputStream ( ( File ) location ) ; data = StreamSupport . absorbInputStream ( in ) ; in . close ( ) ; } else { throw new NoClassDefFoundError ( "file '" + fileName + "' could not be loaded from '" + location + ' ' ) ; } return data ; }
Retrieves resource as byte array from a directory or jar in the file system .