read zipped ion content from s3 in java

180 Views Asked by At

I have a backend service that writes a file created using GZipOutputStream to S3 and the front end wants to display the ION content in it. I tried using GZipInputStream to wrap the InputStream returned by the S3Object getObjectContent() method, but does not seem to be working.

Can anyone help here?

Code to generate zipped file using GzipOutputStream

generateAndWriteInfo() {
 byte[] info = generateInfo();
 gzipOutputStream.write(info);
}

close() {
gzipOutputStream.close();
}

code to read it from S3

S3Object result = client.getObject(bucket_name, key);
byte[] array = IOUtils.toByteArray(result.getObjectContent());
IonDatagram datagram = ios.newLoader().load(IOUtils.toByteArray(new GZIPInputStream(new ByteArrayInputStream(array))));

0

There are 0 best solutions below