Code example for Writer

Methods: append

0
 
	@Override 
	public void renderPad(ImagePad pad,
			IHTMLRendererContext context) throws IOException {
		Writer writer = context.getWriter();
		writer.append("<img src='").append(context.createResourceURL(pad.getContainerID(), "image", new HashMap<String, String>())).append("' />");
	} 
 
	@Override 
	public void renderResource(ImagePad pad, String resourceId, IResourceRenderContext context)
			throws IOException { 
		InputStream is = context.getResourceAsStream("image/" + pad.getImagePath());
		context.setContentType("application/octet-stream");
		OutputStream outputStream = context.getOutputStream();
		try { 
			IOUtils.copy(is, outputStream);
		} finally { 
			is.close();
			outputStream.close();
		} 
	}