public void removeNameUrl ( final String name , final String url ) throws IOException { // need to first see if there is already an entry for this name. // if not, do nothing // if so, loop thru all current url locations for name // keep any that are not url // if any locations are left, update to the new value, sans url // if none are left, remove the entry from the db StringBuilder newValue = new StringBuilder ( ) ; String oldValue = get ( name ) ; if ( oldValue != null && oldValue . length ( ) > 0 ) { String curUrls [ ] = oldValue . split ( urlDelimiterRE ) ; for ( int i = 0 ; i < curUrls . length ; i ++ ) { if ( ! url . equals ( curUrls [ i ] ) ) { if ( newValue . length ( ) > 0 ) { newValue . append ( urlDelimiter ) ; } newValue . append ( curUrls [ i ] ) ; } } if ( newValue . length ( ) > 0 ) { // update put ( name , newValue . toString ( ) ) ; } else { // remove the entry: delete ( name ) ; } } }
remove a single url location for an name if it exists