本文整理汇总了Java中org.gudy.azureus2.core3.download.DownloadManager.getTorrent方法的典型用法代码示例。如果您正苦于以下问题:Java DownloadManager.getTorrent方法的具体用法?Java DownloadManager.getTorrent怎么用?Java DownloadManager.getTorrent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gudy.azureus2.core3.download.DownloadManager
的用法示例。
在下文中一共展示了DownloadManager.getTorrent方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTLSTorrent
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
public static TOTorrent
getTLSTorrent()
{
HashWrapper hash = (HashWrapper)(tls.get()).get("hash");
if ( hash != null ){
try{
AzureusCore core = AzureusCoreFactory.getSingleton();
DownloadManager dm = core.getGlobalManager().getDownloadManager( hash );
if ( dm != null ){
return( dm.getTorrent());
}
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
return( null );
}
示例2: findDownloadManager
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
/**
* @param hash
* @return
*
* @since 3.0.1.7
*/
public DownloadManager findDownloadManager(String hash) {
synchronized (download_map) {
for (Iterator<DownloadManager> iter = download_map.keySet().iterator(); iter.hasNext();) {
DownloadManager dm = iter.next();
TOTorrent torrent = dm.getTorrent();
if (PlatformTorrentUtils.isContent(torrent, true)) {
String thisHash = PlatformTorrentUtils.getContentHash(torrent);
if (hash.equals(thisHash)) {
return dm;
}
}
}
}
return null;
}
示例3: setHasBeenOpened
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
public static void setHasBeenOpened(DownloadManager dm, boolean opened) {
TOTorrent torrent = dm.getTorrent();
if (torrent == null) {
return;
}
if (opened == getHasBeenOpened(dm)) {
return;
}
setContentMapLong(torrent, TOR_AZ_PROP_OPENED, opened ? 1 : 0);
writeTorrentIfExists(torrent);
Object[] array = hasBeenOpenedListeners.toArray();
for (int i = 0; i < array.length; i++) {
try {
HasBeenOpenedListener l = (HasBeenOpenedListener) array[i];
l.hasBeenOpenedChanged(dm, opened);
} catch (Exception e) {
Debug.out(e);
}
}
}
示例4: lookupTorrent
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
public TOTorrent
lookupTorrent(
byte[] hash )
{
List managers = gm.getDownloadManagers();
for (int i=0;i<managers.size();i++){
DownloadManager dm = (DownloadManager)managers.get(i);
TOTorrent t = dm.getTorrent();
if ( t != null ){
try{
if ( Arrays.equals( hash, t.getHash())){
return( t );
}
}catch( TOTorrentException e ){
Debug.printStackTrace( e );
}
}
}
return( null );
}
示例5: canPlay
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
private static boolean canPlay(DownloadManager dm, int file_index) {
if (dm == null) {
return false;
}
TOTorrent torrent = dm.getTorrent();
return canUseEMP(torrent,file_index);
}
示例6: resume
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
protected void
resume(
DownloadManager dm )
{
TOTorrent torrent = dm.getTorrent();
if ( torrent == null ){
return;
}
try{
HashWrapper hw = torrent.getHashWrapper();
synchronized( pause_set ){
if ( !pause_set.remove( hw )){
return;
}
}
dm.resume();
}catch( Throwable e ){
Debug.out( e );
}
}
示例7: handleAutoTag
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
private void
handleAutoTag(
DownloadManager dm )
{
try{
TOTorrent torrent = dm.getTorrent();
if ( torrent != null ){
boolean is_vhdn = PlatformTorrentUtils.getContentNetworkID(torrent) == ContentNetwork.CONTENT_NETWORK_VHDNL;
String content_type = PlatformTorrentUtils.getContentType(torrent);
if ( content_type != null && !content_type.toLowerCase().contains( "vhdn" )){
// content type overrides vhdn unless is specifically says it is
is_vhdn = false;
}
if ( is_vhdn ){
handleAutoTag( dm, "tag.type.man.vhdn", "image.sidebar.tag.vhdn" );
}
if ( content_type != null && content_type.equalsIgnoreCase( "featured" )){
handleAutoTag( dm, "tag.type.man.featcon", "image.sidebar.tag.featcon" );
}
}
}catch( Throwable e ){
Debug.out( e );
}
}
示例8: getHasBeenOpened
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
public static boolean getHasBeenOpened(DownloadManager dm) {
TOTorrent torrent = dm.getTorrent();
if (torrent == null) {
return true;
}
boolean opened = getContentMapLong(torrent, TOR_AZ_PROP_OPENED, -1) > 0;
if (opened || isAdvancedViewOnly(dm)) {
return true;
}
return false;
}
示例9: formatHashFails
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
public static String formatHashFails(DownloadManager download_manager) {
TOTorrent torrent = download_manager.getTorrent();
if (torrent != null) {
long bad = download_manager.getStats().getHashFailBytes();
// size can exceed int so ensure longs used in multiplication
long count = bad / (long) torrent.getPieceLength();
String result = count + " ( " + formatByteCountToKiBEtc(bad) + " )";
return result;
}
return "";
}
示例10: canStream
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
private static boolean
canStream(
DownloadManager dm,
int file_index )
{
if ( dm == null ){
return( false );
}
org.gudy.azureus2.core3.disk.DiskManagerFileInfo file;
if ( file_index == -1 ){
file = dm.getDownloadState().getPrimaryFile();
if (file == null) {
org.gudy.azureus2.core3.disk.DiskManagerFileInfo[] files = dm.getDiskManagerFileInfoSet().getFiles();
if (files.length == 0) {
return false;
}
file = files[0];
}
file_index = file.getIndex();
}else{
file = dm.getDiskManagerFileInfoSet().getFiles()[ file_index ];
}
if ( file.getDownloaded() == file.getLength()){
return( false );
}
if ( !StreamManager.getSingleton().isStreamingUsable()){
return( false );
}
TOTorrent torrent = dm.getTorrent();
return( canUseEMP( torrent, file_index, false ));
}
示例11: pause
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
protected void
pause(
DownloadManager dm )
{
TOTorrent torrent = dm.getTorrent();
if ( torrent == null ){
return;
}
try{
HashWrapper hw = torrent.getHashWrapper();
synchronized( pause_set ){
if ( pause_set.contains( hw )){
return;
}
pause_set.add( hw );
}
dm.pause();
}catch( Throwable e ){
Debug.out( e );
}
}
示例12: getEnhancedDownload
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
public EnhancedDownloadManager
getEnhancedDownload(
DownloadManager manager )
{
TOTorrent torrent = manager.getTorrent();
if ( torrent == null ){
return( null );
}
DownloadManager dm2 = manager.getGlobalManager().getDownloadManager( torrent );
if ( dm2 != manager ){
return null;
}
synchronized( download_map ){
EnhancedDownloadManager res = (EnhancedDownloadManager)download_map.get( manager );
if ( res == null ){
res = new EnhancedDownloadManager( DownloadManagerEnhancer.this, manager );
download_map.put( manager, res );
}
return( res );
}
}
示例13: DiskManagerChannelImpl
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
protected
DiskManagerChannelImpl(
DownloadImpl _download,
org.gudy.azureus2.pluginsimpl.local.disk.DiskManagerFileInfoImpl _plugin_file )
throws DownloadException
{
download = _download;
plugin_file = _plugin_file;
core_file = plugin_file.getCore();
DownloadManager core_download = core_file.getDownloadManager();
if ( core_download.getTorrent() == null ){
throw( new DownloadException( "Torrent invalid" ));
}
if ( core_download.isDestroyed()){
Debug.out( "Download has been removed" );
throw( new DownloadException( "Download has been removed" ));
}
synchronized( DiskManagerChannelImpl.class ){
channel_id = channel_id_next++;
}
TOTorrentFile tf = core_file.getTorrentFile();
TOTorrent torrent = tf.getTorrent();
TOTorrentFile[] tfs = torrent.getFiles();
rtas = new long[torrent.getNumberOfPieces()];
core_download.addPeerListener( this );
for (int i=0;i<core_file.getIndex();i++){
file_offset_in_torrent += tfs[i].getLength();
}
piece_size = tf.getTorrent().getPieceLength();
core_file.addListener( this );
reportCreated( this );
}
示例14: getAllCachedDownloadDetails
import org.gudy.azureus2.core3.download.DownloadManager; //导入方法依赖的package包/类
public static SubscriptionDownloadDetails[]
getAllCachedDownloadDetails(AzureusCore core)
{
List<DownloadManager> dms = core.getGlobalManager().getDownloadManagers();
List<SubscriptionDownloadDetails> result = new ArrayList<SubscriptionDownloadDetails>();
SubscriptionManager sub_man = SubscriptionManagerFactory.getSingleton();
for (int i=0;i<dms.size();i++){
DownloadManager dm = dms.get(i);
TOTorrent torrent = dm.getTorrent();
if ( torrent != null ){
try{
Subscription[] subs = sub_man.getKnownSubscriptions( torrent.getHash());
if ( subs != null && subs.length > 0 ){
if ( sub_man.hideSearchTemplates()){
List<Subscription> filtered = new ArrayList<Subscription>();
for ( Subscription s: subs ){
if ( !s.isSearchTemplate()){
filtered.add( s );
}
}
if ( filtered.size() > 0 ){
result.add( new SubscriptionDownloadDetails( dm, filtered.toArray( new Subscription[filtered.size()] )));
}
}else{
result.add( new SubscriptionDownloadDetails( dm, subs ));
}
}
}catch( Throwable e ){
}
}
}
return(result.toArray( new SubscriptionDownloadDetails[result.size()]));
}