private byte [ ] getAsByteArray ( String template ) throws IOException { if ( isTemplateGivenAsAnAbsoluteFile ( template ) ) { throw new IllegalArgumentException ( "Template " + template + " should not be given as an absolute file" ) ; } if ( ! containsTemplate ( template ) ) { throw new IllegalArgumentException ( "Template " + template + " is not a template" ) ; } java . io . InputStream is = null ; try { is = new FileInputStream ( getAbsoluteTemplate ( template ) ) ; return toByteArray ( is ) ; } finally { closeQuietly ( is ) ; } }
Extract a template from the jar as a byte array