Obtain information about the document format before opening it to avoid an exception if you are not sure what the actual content of the file is using Java.... If you attempt to load a file into a Document object...determine the file format without loading a document with possible exceptions...