public boolean inferPrintableFromMetadata ( Metadata md ) { String inferredCharset = "BINARY" ; List < String > transferEncoding = md . getGlobalMetadata ( ) . getTransferEncoding ( ) ; if ( transferEncoding != null ) { inferredCharset = getCharset ( transferEncoding . get ( transferEncoding . size ( ) - 1 ) ) ; } else if ( md . getGlobalMetadata ( ) . getContentType ( ) != null ) { inferredCharset = getCharset ( md . getGlobalMetadata ( ) . getContentType ( ) ) ; } return inferredCharset . equals ( "UTF-8" ) ; }
Heuristic to infer if content is printable from metadata .