protected BodyPart handleTextPart ( MimePart textPart , String contentType ) throws IOException , MessagingException { String content ; if ( textPart . getContent ( ) instanceof String ) { content = ( String ) textPart . getContent ( ) ; } else if ( textPart . getContent ( ) instanceof InputStream ) { content = FileUtils . readToString ( ( InputStream ) textPart . getContent ( ) , Charset . forName ( parseCharsetFromContentType ( contentType ) ) ) ; } else { throw new CitrusRuntimeException ( "Cannot handle text content of type: " + textPart . getContent ( ) . getClass ( ) . toString ( ) ) ; } return new BodyPart ( stripMailBodyEnding ( content ) , contentType ) ; }
Construct simple binary body part with base64 data .