public static String getFileFormat ( POIFSFileSystem fs ) throws IOException { String fileFormat = "" ; DirectoryEntry root = fs . getRoot ( ) ; if ( root . getEntryNames ( ) . contains ( "\1CompObj" ) ) { CompObj compObj = new CompObj ( new DocumentInputStream ( ( DocumentEntry ) root . getEntry ( "\1CompObj" ) ) ) ; fileFormat = compObj . getFileFormat ( ) ; } return fileFormat ; }
This method allows us to peek into the OLE compound document to extract the file format . This allows the UniversalProjectReader to determine if this is an MPP file or if it is another type of OLE compound document .