FileDocCategorySizeDatePackage
DownloadUtils.javaAPI DocAzureus 3.0.3.42545Mon May 14 10:45:20 BST 2007com.aelitis.azureus.util

DownloadUtils

public class DownloadUtils extends Object

Fields Summary
private static org.gudy.azureus2.plugins.torrent.TorrentAttribute
ta_tracker_extensions
Constructors Summary
Methods Summary
public static synchronized voidaddTrackerExtension(org.gudy.azureus2.plugins.download.Download download, java.lang.String extension_prefix, java.lang.String extension_value)

		String	extension = "&" + extension_prefix + "=" + extension_value;
		
		String value = download.getAttribute( ta_tracker_extensions );

		if ( value != null ){

				// if already exists then bail
			
			if ( value.indexOf( extension ) != -1 ){

				return;
			}

				// if prefix exists then remove existing value
			
			if ( value.indexOf( extension_prefix ) != -1 ){

				String[] bits = value.split("&");

				value = "";

				for ( int i=0; i<bits.length; i++ ){

					String bit = bits[i].trim();

					if ( bit.length() == 0 ){

						continue;
					}

					if ( !bit.startsWith(extension_prefix.substring(1))){

						value += "&" + bit;
					}
				}
			}

			value += extension;

		}else{

			value = extension;
		}

		download.setAttribute( ta_tracker_extensions, value );
	
protected static voidinitialise(com.aelitis.azureus.core.AzureusCore core)

		PluginInterface pi = core.getPluginManager().getDefaultPluginInterface();

		TorrentManager tm = pi.getTorrentManager();

		ta_tracker_extensions = tm.getAttribute( TorrentAttribute.TA_TRACKER_CLIENT_EXTENSIONS );