How to get size of GZIPPED file in BYTES Java

时间:2016-08-31 18:47:17

标签: java gzip

I am passing a GZIPPED file through postman as a @RequestBody. I would like to know the size of this file, how can I do this in Java.

I tried this but it doesn't return the correct size:

public int testing(@RequestBody byte[] binary){
  return binary.size
}

1 个答案:

答案 0 :(得分:-2)

我尝试了bytes.length,现在返回正确的文件大小。在它返回错误的数字之前,我不确定为什么会这样做,但现在它始终返回正确的文件大小。