I am interested in using a few methods from OleFormat to extract OLEs from RTF files. We need it to:
- reliably extract the original (native) file using the OleFormat#save API.
- reliably identify the file type using OleFormat#getSuggestedExtension
It is critical that the bytes extracted and the file extension are both valid such that when we save that OutputStream to disk it will be possible for the user to open the embedded file using the original application.
Are there any known issues or limitations? Which file types can it reliably handle?
I ask as I noticed we had a bit of prior work in this area and it seems there is some fallback logic for the getSuggestedExtension() method to handle a case where it might return null or “.bin”, both of which aren’t correct. In that case, we use OleFormat#getProgId to determine a suitable fallback extension based on the program ID. For example, “Excel.Sheet.12” == “.xlsx”