private void handleContentLength ( Event event ) { if ( event . getContent ( ) == null ) { return ; } if ( maxContentLength == - 1 || event . getContent ( ) . length ( ) <= maxContentLength ) { return ; } if ( maxContentLength < CUT_START_TAG . length ( ) + CUT_END_TAG . length ( ) ) { event . setContent ( "" ) ; event . setContentCut ( true ) ; return ; } int contentLength = maxContentLength - CUT_START_TAG . length ( ) - CUT_END_TAG . length ( ) ; event . setContent ( CUT_START_TAG + event . getContent ( ) . substring ( 0 , contentLength ) + CUT_END_TAG ) ; event . setContentCut ( true ) ; }
Handle content length .