0

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))));

Matthew Pope
  • 7,212
  • 1
  • 28
  • 49
Ankita Dahad
  • 35
  • 1
  • 7
  • Can you show your code and give more details about what "does not seem to be working"? – Joni Apr 07 '20 at 19:36
  • added to question... I did some investigation and it seems the file generated is corrupt and missing the End-of-central-directory signature. – Ankita Dahad Apr 08 '20 at 17:06

0 Answers0