I have a bit of a problem around here, I just can't get it done.

The thing is that I'm using POI for a project in Java and I have to get the final outputs in .xls format(HSSF for Apache).

So, my business rules state that each file I generate has to be 12 MB as a maximun file size.

But I know .xls has some internal way of dealing the data(XML I guess), so this adds more bytes than just putting the result in a plain text file. I just can't get the size of the Excel Workbook since it generates itself in a temporal location(I can't find it) and I just can't read it while writting.

Is there any way to get the size in bytes of the Excel output file while Java writes to it using the HSSF Workbook Object?