public static byte [ ] readFileFromClasspath ( String fileName ) throws IOException { InputStream is = Utils . class . getClassLoader ( ) . getResourceAsStream ( fileName ) ; byte [ ] data = ByteStreams . toByteArray ( is ) ; try { is . close ( ) ; } catch ( IOException ex ) { } return data ; }
Read a file from classpath