question: @ TargetApi ( LOLLIPOP ) private BonjourEvent newBonjourEvent ( BonjourEvent . Type type , NsdServiceInfo serviceInfo ) { BonjourService . Builder serviceBuilder = new BonjourService . Builder ( serviceInfo . getServiceName ( ) , serviceInfo . getServiceType ( ) ) ; if ( Build . VERSION . SDK_INT >= LOLLIPOP ) { Map < String , byte [ ] > attributes = serviceInfo . getAttributes ( ) ; for ( String key : attributes . keySet ( ) ) { serviceBuilder . addTxtRecord ( key , new String ( attributes . get ( key ) , Charset . forName ( "UTF-8" ) ) ) ; } } serviceBuilder . addAddress ( serviceInfo . getHost ( ) ) ; serviceBuilder . setPort ( serviceInfo . getPort ( ) ) ; return new BonjourEvent ( type , serviceBuilder . build ( ) ) ; }
target:  Creates a new BonjourEvent instance from an Nsd Service info object.