Class MetadataExtractor


  • @Singleton
    public class MetadataExtractor
    extends Object
    This tool is kind of interface between the Silverpeas callers which needs to get metadata from files and the API used to extract them.
    • Method Detail

      • initialize

        @PostConstruct
        protected void initialize()
      • extractMetadata

        public MetaData extractMetadata​(String filePath)
        Extracts Metadata of a file.
        Parameters:
        filePath - the full path of a file.
        Returns:
        a MetaData instance that handles the metadata extracted from a file represented by the given full path.
      • extractMetadata

        public MetaData extractMetadata​(File file)
        Extracts Metadata of a file.
        Parameters:
        file - a file.
        Returns:
        a MetaData instance that handles the metadata extracted from the given file.
      • detectMimeType

        public String detectMimeType​(File file)
                              throws IOException
        Detects the media type of the given file. The type detection is based on the document content and a potential known file extension.
        Parameters:
        file - the file
        Returns:
        detected media type
        Throws:
        IOException - if the file can not be read