java - GZIPInputStream is prematurely closed when reading from s3 -
new bufferedreader(new inputstreamreader( new gzipinputstream(s3service.getobject(bucket, objectkey).getdatainputstream()))) creates reader returns null readline() after ~100 lines if file greater several mb. not reproducible on gzip files less 1 mb. knows how handle this?
from documentation of bufferedreader#readline():
returns:
a string containing contents of line, not including line-termination characters, or null if end of stream has been reached
i pretty clear means: end of file/stream has been encountered - no more data available.
notable quirks gzip format: multiple files can appended one-another create larger file multiple gzipped objects. seems gzipinputstream reads first of those.
that explains why working "small files". contain 1 zipped object, whole file read.
note: if gzipinputstream determines undestructively 1 gzip-file over, open gzipinputstream on same inputstream , read multiple objects.
Comments
Post a Comment