我正在压缩文件并将其写入输出流,如何获取压缩文件大小以放入响应标头
os = response.getOutputStream();
gzos = new GZIPOutputStream(os);
fin = new FileInputStream(file);
in = new BufferedInputStream(fin);
byte[] buffer = new byte[1024];
int i;
while ((i = in.read(buffer)) >= 0) {
gzos.write(buffer, 0, i);
}
gzos.flush();