Thanks for your posting and using Aspose.Cells for Java.
Yes, it is quite possible to save your output stream into a memory stream. Aspose.Cells for Java saves your file in Stream and this Stream could be a file stream or memory stream as per user needs.
For example, the following code creates a workbook object, you can create it from your source/template file or you can create it from scratch with its default constructor, then you do whatever processing you like.
Finally, it saves the workbook object int csv format inside a memory using ByteArrayOutputStream object.
I have fully commented the code and you will not have any trouble understanding it. You can then modify this code as per your needs.
String filePath = “F:\Shak-Data-RW\Downloads\test.xlsx”;
//Create your workbook from any source xls/xlsx file
//You can also create empty/default workbook
Workbook workbook = new Workbook(filePath);
//Do your processing whatever you like
//Now save your workbook into csv format in memory
//We will will use ByteArrayOutputStream because everything will be stored
ByteArrayOutputStream bout = new ByteArrayOutputStream();
//Now you can save it on disk to check if the ByteArrayOutputStream
//contains your proper output file data
byte outputFileData = bout.toByteArray();
FileOutputStream fout = new FileOutputStream(filePath + “.out.csv”);