Reading from a GZIPInputStream (JAVA)

Dear Laurence,



Reading from a GZIPInputStream from a compressed document is the same
as reading from an ordinary InputStream of a decompressed document.
When calling the read method of the GZIPInputStream, the decompressed
bytes are returned. None of the other api’s we have tested like
JExcelApi, POI and other commercial alternatives have any problem
reading from the stream described below and they only support excel
files in their raw format.



Previous message:



In our database all excel documents are stored in the gzip format. When
loading a workbook the following construction is used:


byte[] content = ...;
InputStream in = GZIPInputStream(new ByteArrayInputStream(content));

Workbook book = new Workbook();
book.read(in);

The strange thing is that Apose Excel crashes with the following exception:

java.io.IOException: End of file reached.
at com.aspose.excel.aK.b(Unknown Source)
at com.aspose.excel.aK.d(Unknown Source)
at com.aspose.excel.aK.f(Unknown Source)
at com.aspose.excel.aK.g(Unknown Source)
at com.aspose.excel.aQ.(Unknown Source)
at com.aspose.excel.aZ.a(Unknown Source)
at com.aspose.excel.aZ.(Unknown Source)
at com.aspose.excel.Workbook.read(Unknown Source)
at com.te.base.util.excel.TEAsposeWorkbook.(TEAsposeWorkbook.java:79)
at com.te.base.util.excel.TEWorkbook.getWorkbook(TEWorkbook.java:853)
at com.te.base.util.excel.TEWorkbook.getInstance(TEWorkbook.java:612)

This does not happen if we first decompress the document.

You can easily reproduce this error på gzipping any workbook and loading your Workbook from the following stream:
new GZIPInputStream(new BufferedInputStream(new FileInputStream("book.gz")));

Thanks,
Ulf Ekström

Hi Ulf,

We will check and fix this issue soon.