private ContentType parseContentType ( String value ) { String [ ] pcs = value . split ( "\\;" ) ; String mimeType = pcs [ 0 ] . trim ( ) ; String charSet = "UTF-8" ; for ( int i = 1 ; i < pcs . length ; i ++ ) { String s = pcs [ i ] . trim ( ) . toUpperCase ( ) ; if ( s . startsWith ( "CHARSET=" ) ) { charSet = s . substring ( 8 ) ; break ; } } return ContentType . create ( mimeType , charSet ) ; }
Parse the returned content type .