java的restlet主要代码:
finalbyte[] result = //图片流字节;returnnew OutputRepresentation(MediaType.IMAGE_PNG) { publicvoid write(OutputStream os) throws IOException { os.write(result); os.flush(); os.close(); } };
这样浏览器就能正确识别该图片,并在浏览器中识别出来。
当然也可以是img标签的src中显示。
原文地址:http://www.cnblogs.com/wxxian001/archive/2013/04/24/3040648.html