@ SuppressWarnings ( "unchecked" ) public T finish ( ) throws IOException { if ( _open ) { _closeChild ( ) ; _open = false ; if ( _closeGenerator ) { _generator . close ( ) ; } else if ( Feature . FLUSH_AFTER_WRITE_VALUE . isEnabled ( _features ) ) { _generator . flush ( ) ; } } if ( _result == null ) { Object x ; if ( _stringWriter != null ) { x = _stringWriter . getAndClear ( ) ; _stringWriter = null ; } else if ( _byteWriter != null ) { x = _byteWriter . toByteArray ( ) ; _byteWriter = null ; } else { x = _generator . getOutputTarget ( ) ; } _result = ( T ) x ; } return _result ; }
Method to call to complete composition flush any pending content and return instance of specified result type .