FileDocCategorySizeDatePackage
AzureusPlatformContentDirectory.javaAPI DocAzureus 3.0.3.42999Sat Jun 02 14:10:12 BST 2007com.aelitis.azureus.core.content

AzureusPlatformContentDirectory

public class AzureusPlatformContentDirectory extends Object implements AzureusContentDirectory

Fields Summary
private static boolean
registered
Constructors Summary
Methods Summary
public AzureusContentlookupContent(java.util.Map attributes)

		byte[]	hash = (byte[])attributes.get( AT_BTIH );
		
		if ( hash == null ){
			
			return( null );
		}
		
		String	url_str = Constants.URL_PREFIX + Constants.URL_DOWNLOAD + Base32.encode( hash ) + ".torrent";
		
		ResourceDownloaderFactory rdf = ResourceDownloaderFactoryImpl.getSingleton();
		
		try{
			ResourceDownloader rd = rdf.create( new URL( url_str ));
		
			InputStream	is = rd.download();
			
			try{		
				TOTorrent	torrent = TOTorrentFactory.deserialiseFromBEncodedInputStream( is );
			
				return( new AzureusPlatformContent( new TorrentImpl( torrent )));
				
			}finally{
				
				is.close();
			}
			
		}catch( Throwable e ){
			
			e.printStackTrace();
			
			return( null );
		}
	
public static synchronized voidregister()

	
	   
	
	
		if ( !registered ){
		
			registered = true;
			
			AzureusContentDirectoryManager.registerDirectory( new AzureusPlatformContentDirectory());
		}