105106107108109110111112113
ByteStreamCache bs = new ByteStreamCache(); InputStream is = new ReaderInputStream(new StringReader(text),"utf-8"); bs.copyFrom(is); resp.setContentLength((int)bs.getLength()); OutputStream os = resp.getOutputStream(); bs.copyTo(os); os.flush(); } }