FileDocCategorySizeDatePackage
TRHostExternalTorrent.javaAPI DocAzureus 3.0.3.47051Tue Dec 19 09:26:54 GMT 2006org.gudy.azureus2.core3.tracker.host.impl

TRHostExternalTorrent

public class TRHostExternalTorrent extends Object implements TOTorrent
author
parg

Fields Summary
private byte[]
name
private byte[]
hash
private HashWrapper
hash_wrapper
private URL
announce_url
protected Map
additional_properties
protected AEMonitor
this_mon
Constructors Summary
protected TRHostExternalTorrent(byte[] _hash, URL _announce_url)


	
	
			
				  
	
		hash			= _hash;
		hash_wrapper	= new HashWrapper( hash );
		announce_url	= _announce_url;
		
		name = ByteFormatter.nicePrint( hash, true ).getBytes();
		
		try{
			LocaleTorrentUtil.setDefaultTorrentEncoding( this );
			
		}catch( LocaleUtilEncodingException e ){
			
			Debug.printStackTrace( e );
		}
	
Methods Summary
public voidaddTorrentAnnounceURLSet(java.net.URL[] urls)

	
public byte[]getAdditionalByteArrayProperty(java.lang.String name)

		return( (byte[])additional_properties.get(name));
	
public java.util.ListgetAdditionalListProperty(java.lang.String name)

		return((List)additional_properties.get(name));
	
public java.lang.LonggetAdditionalLongProperty(java.lang.String name)

		return((Long)additional_properties.get(name));
	
public java.util.MapgetAdditionalMapProperty(java.lang.String name)

		return( (Map)additional_properties.get(name));
	
public java.lang.ObjectgetAdditionalProperty(java.lang.String name)

		return( additional_properties.get(name));
	
public java.lang.StringgetAdditionalStringProperty(java.lang.String name)

		try{
			Object	obj = additional_properties.get(name);

			if ( obj == null ){
				
				return( null );
			}
			
			if ( !( obj instanceof byte[] )){
				
				Debug.out( "property '" + name + "' is not a byte[]: " + obj );
				
				return( null );
			}
			
			return( new String((byte[])obj,Constants.DEFAULT_ENCODING));
			
		}catch( Throwable e ){
			
			Debug.printStackTrace( e );
			
			return( null );
		}
	
public java.net.URLgetAnnounceURL()

		return( announce_url );
	
public TOTorrentAnnounceURLGroupgetAnnounceURLGroup()

		return( 
			new TOTorrentAnnounceURLGroup()
			{
				public TOTorrentAnnounceURLSet[]
               	getAnnounceURLSets()
				{
					return( new TOTorrentAnnounceURLSet[0] );
				}
 
               	public void
               	setAnnounceURLSets(
               		TOTorrentAnnounceURLSet[]	sets )
				{
				}
               		
               	public TOTorrentAnnounceURLSet
               	createAnnounceURLSet(
               		URL[]	urls )
				{
					return( new TOTorrentAnnounceURLSet()
							{
								public URL[]
						       	getAnnounceURLs()
								{
									return( new URL[0]);
								}
						       	
						       	public void
						       	setAnnounceURLs(
						       		URL[]		urls )
								{
								}
							});
				}
			});
	
public byte[]getComment()

		return( null );
	
public byte[]getCreatedBy()

		return( null );
	
public longgetCreationDate()

		return(0);
	
public TOTorrentFile[]getFiles()

		return( new TOTorrentFile[0]);
	
public byte[]getHash()

		return( hash );
	
public HashWrappergetHashWrapper()

		return( hash_wrapper );
	
public AEMonitorgetMonitor()

   		return( this_mon );
   	
public byte[]getName()

		return( name );
	
public intgetNumberOfPieces()

		return( 0);
	
public longgetPieceLength()

		return( -1 );
	
public byte[][]getPieces()

		return( new byte[0][] );
	
public booleangetPrivate()

		return( false );
	
public longgetSize()

		return( -1 );
	
public booleanhasSameHashAs(TOTorrent other)

		try{
			byte[]	other_hash = other.getHash();
			
			return( Arrays.equals( hash, other_hash ));
			
		}catch( TOTorrentException e ){
			
			Debug.printStackTrace( e );
			
			return( false );
		}
	
public booleanisCreated()

		return( false );
	
public booleanisSimpleTorrent()

		return( true );
	
public voidprint()

	
public voidremoveAdditionalProperties()

		additional_properties.clear();
	
public voidremoveAdditionalProperty(java.lang.String name)

		additional_properties.remove( name );
	
public voidserialiseToBEncodedFile(java.io.File file)

		throw( new TOTorrentException("External Torrent", TOTorrentException.RT_WRITE_FAILS ));
	
public java.util.MapserialiseToMap()

		throw( new TOTorrentException("External Torrent", TOTorrentException.RT_WRITE_FAILS ));
	
public voidserialiseToXMLFile(java.io.File file)

		throw( new TOTorrentException("External Torrent", TOTorrentException.RT_WRITE_FAILS ));
	
public voidsetAdditionalByteArrayProperty(java.lang.String name, byte[] value)

		additional_properties.put(name,value);
	
public voidsetAdditionalListProperty(java.lang.String name, java.util.List value)

		additional_properties.put(name,value);
	
public voidsetAdditionalLongProperty(java.lang.String name, java.lang.Long value)

		additional_properties.put(name,value);
	
public voidsetAdditionalMapProperty(java.lang.String name, java.util.Map value)

		additional_properties.put(name,value);
	
public voidsetAdditionalProperty(java.lang.String name, java.lang.Object value)

		if ( name instanceof String ){
			
			setAdditionalStringProperty(name,(String)value);
			
		}else{
		
			additional_properties.put( name, value );
		}
	
public voidsetAdditionalStringProperty(java.lang.String name, java.lang.String value)

		try{
		
			additional_properties.put(name,value.getBytes(Constants.DEFAULT_ENCODING));
			
		}catch( Throwable e ){
			
			Debug.printStackTrace( e );
		}
	
public booleansetAnnounceURL(java.net.URL url)

		return false;
	
public voidsetComment(java.lang.String comment)

		
	
public voidsetCreationDate(long date)

	
public voidsetPieces(byte[][] b)

	
public voidsetPrivate(boolean _private)