private byte[] process(byte[] input, PropertyResolver props) throws IOException {
VelocityContext context = new VelocityContext();
context.put("context", props);
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Writer writer = new OutputStreamWriter(baos);
Velocity.evaluate(context, writer, "", new InputStreamReader(new ByteArrayInputStream(input)));
writer.flush();
return baos.toByteArray();
}
catch (IOException ioe) {
throw new IOException("Error processing the artifact: " + ioe.getMessage());
}
}
|