文件下载中使用inputStream流获取文件大小
程序员文章站
2023-12-10 08:10:52
inputStream.available()获取的是文件的字节大小 InputStream inputStream = new FileInputStream(new File(path)); response.setHeader("Content-Length", String.valueOf(... ......
inputstream.available()获取的是文件的字节大小
inputstream inputstream = new fileinputstream(new file(path)); response.setheader("content-length", string.valueof(inputstream.available()));