Package org.silverpeas.core.io.media
Class MetadataExtractor
- java.lang.Object
-
- org.silverpeas.core.io.media.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
detectMimeType(File file)
Detects the media type of the given file.MetaData
extractMetadata(File file)
Extracts Metadata of a file.MetaData
extractMetadata(String filePath)
Extracts Metadata of a file.static MetadataExtractor
get()
protected void
initialize()
-
-
-
Method Detail
-
get
public static MetadataExtractor get()
-
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
-
-