public synchronized void setDeviceName ( String name ) { if ( name . getBytes ( ) . length > DEVICE_NAME_LENGTH ) { throw new IllegalArgumentException ( "name cannot be more than " + DEVICE_NAME_LENGTH + " bytes long" ) ; } Arrays . fill ( announcementBytes , DEVICE_NAME_OFFSET , DEVICE_NAME_LENGTH , ( byte ) 0 ) ; System . arraycopy ( name . getBytes ( ) , 0 , announcementBytes , DEVICE_NAME_OFFSET , name . getBytes ( ) . length ) ; }
Set the name to be used in announcing our presence on the network . The name can be no longer than twenty bytes and should be normal ASCII no Unicode .