Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





Java - Code Samples

 Sample 1. Code Sample / Example / Snippet of org.apache.velocity.VelocityContext

    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());

}

}


   Like      Feedback      org.apache.velocity.VelocityContext



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner