How to change the Apache POI SXSSFWorkbook default temporary file name How to change the Apache POI SXSSFWorkbook default temporary file name apache apache

How to change the Apache POI SXSSFWorkbook default temporary file name


The main class that Apache POI uses for this is TempFile

The method you'll want to call is TempFile.setTempFileCreationStrategy

What you'll need to do is create your own class implementing the interface TempFileCreationStrategy. This is nice and simple, with just two methods, createTempDirectory and createTempFile.

To get an idea of what's involved, you can look at the source code for DefaultTempFileCreationStrategy online here. It's pretty easy, just put in the logic for your own needs in terms of threading and naming.