Changed the API for Template.

Use write instead of trying to get the InputStream of the template instance.