protected final Metadata prepareMetadata ( final Binary binary , final Context context ) throws IOException , RepositoryException { Metadata metadata = new Metadata ( ) ; String mimeType = binary . getMimeType ( ) ; if ( StringUtil . isBlank ( mimeType ) ) { // Call the detector (we don't know the name) ... mimeType = context . mimeTypeOf ( null , binary ) ; } if ( ! StringUtil . isBlank ( mimeType ) ) { metadata . set ( Metadata . CONTENT_TYPE , mimeType ) ; } return metadata ; }
Creates a new tika metadata object used by the parser . This will contain the mime - type of the content being parsed if this is available to the underlying context . If not Tika s autodetection mechanism is used to try and get the mime - type .