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.
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();
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)
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")));