刚刚看完世纪论坛《文学和我们的时代》 >>
<< Modify the ownership of a folder/file in Linux
FileInputStream和FileReader

Author Zhou Renjian Create@ 2006-11-25 03:32
whizz Note icon
TransformerFactory tFactory = TransformerFactory.newInstance();
//String ebookBase = "F:/jakarta-tomcat-5.0.28/webapps/ROOT/whizzebooks";
Transformer transformer = tFactory
        .newTransformer(new StreamSource(new File(XSL_BASE_PATH, "category.xsl")));
transformer.setOutputProperty("encoding", "gb2312");
FileInputStream xml = new FileInputStream(new File(XSL_BASE_PATH, path));

StringWriter html = new StringWriter();
transformer.transform(new StreamSource(xml),
        new StreamResult(html));
response.getWriter().write(html.toString());
如果使用FileReader的话,可能在不同的平台上出现乱码现象!

推荐用FileInputStream。
本记录所在类别:
本记录相关记录: