Get supported file formats

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Metadata MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-metadata -- dnx GroupDocs.Metadata.Mcp --yes
Folders, licensing and more →

The getSupportedFileTypes method of the FileType class is used to obtain a list of supported file types.

An example of obtaining a list of supported file types is presented below.

Iterable<FileType> supportedFileTypes = FileType.getSupportedFileTypes();
Iterator iterator = supportedFileTypes.iterator();      
while (iterator.hasNext()) {
    FileType fileType = (FileType)iterator.next();
    System.out.println(fileType.getExtension() + " - " + fileType.getDescription());
}

Get supported features for a file type

Not every format supports every operation. Some formats can only be read, for example. The FileTypeFeatureSupport class describes which features are available for a file type:

Feature (ProductFeature)Meaning
AutoDetectionThe format is detected by the file content
ReadMetadata can be read
EditMetadata can be added or updated
RemoveMetadata can be removed

Each feature has a SupportLevel: Supported, PartiallySupported or NotSupported.

The getSupportedFileTypeFeatures method has three overloads: it accepts a FileType, a file extension, or no arguments to return the whole matrix.

advanced_usage.GetSupportedFileTypeFeatures

public class GetSupportedFileTypeFeatures {
    public static void run() {
        // Get the support matrix for a specific file type
        FileTypeFeatureSupport pdf = FileTypeFeatureSupport.getSupportedFileTypeFeatures(FileType.PDF);
        printFeatures(pdf);

        // ... or look it up by file extension
        FileTypeFeatureSupport ogg = FileTypeFeatureSupport.getSupportedFileTypeFeatures(".ogg");
        printFeatures(ogg);

        // Get the whole matrix
        Map<FileType, FileTypeFeatureSupport> matrix = FileTypeFeatureSupport.getSupportedFileTypeFeatures();
        System.out.println(String.format("Total file types described: %d", matrix.size()));
    }

    private static void printFeatures(FileTypeFeatureSupport support) {
        System.out.println(String.format("%s (%s): %s", support.getExtension(), support.getFormatFamily(), support.getDescription()));
        for (FeatureSupport feature : support.getFeatures()) {
            System.out.println(String.format("    %s: %s", feature.getFeature(), feature.getLevel()));
        }
    }
}

The following helper checks whether a file can be edited before you try to update it:

static boolean canEdit(String extension) {
    FileTypeFeatureSupport support = FileTypeFeatureSupport.getSupportedFileTypeFeatures(extension);
    for (FeatureSupport feature : support.getFeatures()) {
        if (feature.getFeature() == ProductFeature.Edit) {
            return feature.getLevel() != SupportLevel.NotSupported;
        }
    }
    return false;
}

For example, canEdit(".docx") returns true and canEdit(".gz") returns false.

Note
For an extension that is not registered, getSupportedFileTypeFeatures(String) throws java.util.NoSuchElementException instead of returning null. Catch the exception if the extension comes from user input.

More resources

Advanced usage topics

To learn more about library features and get familiar how to manage metadata and more, please refer to theadvanced usage section.

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document metadata management App

Along with a full featured Java library we provide simple, but powerful free Apps.

You are welcome to view and edit metadata of PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, emails, images and more with our free online Free Online Document Metadata Viewing and Editing App.