This is documented behavior. Javadoc says that getSize()...
"Returns the uncompressed size of the record data, or -1 if not known."
Obviously, this is a situation where the actual size of the uncompressed data is unknown. Your application will simply deal with this.
Followup
You commented on another answer:
Although we have a common content size, I think that without a separate file size, we cannot read files.
, ByteArrayOutputStream, toByteArray(), byte[]. , , ( Tom Hawtin) , , , , ... ByteArrayOutputStream.
(, , ... 2- . , baos .)