2021
01-12
01-12
Java下载文件的4种方式总结
1.以流的方式下载.publicHttpServletResponsedownload(Stringpath,HttpServletResponseresponse){try{//path是指欲下载的文件的路径。Filefile=newFile(path);//取得文件名。Stringfilename=file.getName();//取得文件的后缀名。Stringext=filename.substring(filename.lastIndexOf(".")+1).toUpperCase();//以流的形式下载文件。InputStreamfis=newBufferedInputStream(newFileInp...
继续阅读 >