public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); InputStream fi = new FileInputStream("P:\\cssz.swf"); byte[] b = new byte[10240]; int len; while ((len = fi.read(b)) != -1) { response.getOutputStream().write(b); } fi.close(); }这样呢,在服务器上将文件读出来,然后将流返回,不知道是不是你说已经用过的,
throws ServletException, IOException {
response.setContentType("text/html");
InputStream fi = new FileInputStream("P:\\cssz.swf");
byte[] b = new byte[10240];
int len;
while ((len = fi.read(b)) != -1) {
response.getOutputStream().write(b);
}
fi.close();
}这样呢,在服务器上将文件读出来,然后将流返回,不知道是不是你说已经用过的,
嗯,是的,用 getOutputStream() 写的时候,在linux中有问题,下载大小是0, 不过现在试了下 response.getWriter();写,是有大小返回的,不过可能是编码问题,写出来的的大小比源文件要大,p = response.getWriter();
int j = bis.read();
while (j != -1)
{
p.write((char)j);
j = bis.read();
}