Examples of Torrent


Examples of com.torrent4j.model.Torrent

            .get("frame-decoder")).setHandshaked(true);
        ((PeerWireMessageDecoder) e.getChannel().getPipeline()
            .get("message-decoder")).setHandshaked(true);

        final Hash hash = new Hash(HashType.SHA1, message.torrentHash);
        final Torrent torrent = controller.findTorrent(hash);

        if (torrent == null) {
          e.getChannel().disconnect();
          return;
        }

        TorrentPeer peer = torrent.getSwarm().findPeer(
            (InetSocketAddress) e.getChannel().getRemoteAddress(),
            message.peerID);
        if (peer == null) {
          peer = new TorrentPeer(torrent);
          peer.setAddress((InetSocketAddress) e.getChannel()
View Full Code Here

Examples of com.turn.ttorrent.common.Torrent

        }

        String creator = String.format("%s (ttorrent)",
          System.getProperty("user.name"));

        Torrent torrent = null;
        if (source.isDirectory()) {
          File[] files = source.listFiles();
          Arrays.sort(files);
          torrent = Torrent.create(source, Arrays.asList(files),
              announceList, creator);
        } else {
          torrent = Torrent.create(source, announceList, creator);
        }

        torrent.save(fos);
      } else {
        Torrent.load(new File(filenameValue), true);
      }
    } catch (Exception e) {
      logger.error("{}", e.getMessage(), e);
View Full Code Here

Examples of org.eclipse.ecf.protocol.bittorrent.Torrent

          throw new IOException("file="+localFileToSave.getAbsolutePath()+" does not exist or cannot be written to"); //$NON-NLS-1$ //$NON-NLS-2$
        }

        final TorrentFile file = new TorrentFile(((TorrentID) remoteFileReference).getFile());
        file.setTargetFile(localFileToSave);
        final Torrent torrent = TorrentFactory.createTorrent(file);
        transfer = new TorrentFileTransfer(remoteFileReference, transferListener, torrent);
        return transfer;
      }

      public IIncomingFileTransfer receive(File localFileToSave, FileTransferJob fileTransferJob) throws IOException {
        if (cancelled) {
          throw new RuntimeException(new UserCancelledException());
        }

        Assert.isNotNull(localFileToSave, "localFileToSave must not be null"); //$NON-NLS-1$

        if (localFileToSave.exists() && !localFileToSave.canWrite()) {
          throw new IOException("file="+localFileToSave.getAbsolutePath()+" does not exist or cannot be written to"); //$NON-NLS-1$ //$NON-NLS-2$
        }

        final TorrentFile file = new TorrentFile(((TorrentID) remoteFileReference).getFile());
        file.setTargetFile(localFileToSave);
        final Torrent torrent = TorrentFactory.createTorrent(file);
        transfer = new TorrentFileTransfer(remoteFileReference, transferListener, torrent);
        return transfer;
      }

      public void cancel() {
View Full Code Here

Examples of org.gudy.azureus2.plugins.torrent.Torrent

       
        return( null );
       
      }
     
      Torrent  torrent = download.getTorrent();
     
      if ( torrent.isPrivate()){
       
        Debug.out( "Attempt to download private torrent" );
       
        ddb.log( "TorrentDownload: request from " + originator + "  for '" + download.getName() + "' denied as it is private" );
       
          // should never happen as private torrents are not tracked so they can't be found for
          // download
       
        return( null );
      }
     
      String  msg = "TorrentDownload: request from " + originator + "  for '" + download.getName() + "' OK";   

      if ( TRACE ){
       
        System.out.println( msg );
      }
     
      ddb.log( msg );
     
      HashWrapper  hw = new HashWrapper( torrent.getHash());
     
      synchronized( data_cache ){
       
        Object[]  data = (Object[])data_cache.get( hw );
       
        if ( data != null ){
                   
          data[1] = new Long( SystemTime.getCurrentTime());
         
          return( ddb.createValue((byte[])data[0]));
        }
      }
     
     
      torrent = torrent.removeAdditionalProperties();
     
        // when clients get a torrent from the DHT they take on
        // responsibility for tracking it too
     
      torrent.setDecentralisedBackupRequested( true );
     
      byte[] data = torrent.writeToBEncodedData();
             
      data = encrypt( torrent.getHash(), data );
       
      if ( data == null ){
         
        return( null );
      }
View Full Code Here

Examples of org.gudy.azureus2.plugins.torrent.Torrent

      for (int i=0; i < items.size(); i++){       
      
      ShareItem  item = (ShareItem)items.get(i);
       
        try{
        Torrent  t = item.getTorrent();
                  
        Download  download = dm.getDownload( t );
       
        if ( download == null ){
                   
View Full Code Here

Examples of org.gudy.azureus2.plugins.torrent.Torrent

      for (int i=0;i<items.size();i++){
       
        ShareItem  item = (ShareItem)items.get(i);
       
          try{
            Torrent  t = item.getTorrent();
           
            TrackerTorrent  tracker_torrent = tracker.getTorrent( t );
           
            Download  download = dm.getDownload( t );
           
View Full Code Here

Examples of org.gudy.azureus2.plugins.torrent.Torrent

       
        Download download = downloads.get( i );
       
        DownloadManager  core_download = PluginCoreUtils.unwrap( download );
       
        Torrent torrent = download.getTorrent();
       
        byte[] hash = torrent.getHash();
       
        String  hash_str = Base32.encode( hash );
       
        pw.println( "<item>" );
       
        pw.println( "<title>" + escape( download.getName()) + "</title>" );
       
        pw.println( "<guid>" + hash_str + "</guid>" );
       
        String magnet_url = UrlUtils.getMagnetURI( hash );

        pw.println( "<link>" + magnet_url + "</link>" );
       
        long added = core_download.getDownloadState().getLongParameter(DownloadManagerState.PARAM_DOWNLOAD_ADDED_TIME);
       
        pw.println"<pubDate>" + TimeFormatter.getHTTPDate( added ) + "</pubDate>" );
       
        pw.println"<vuze:size>" + torrent.getSize()+ "</vuze:size>" );
        pw.println"<vuze:assethash>" + hash_str + "</vuze:assethash>" );
                       
        pw.println( "<vuze:downloadurl>" + magnet_url + "</vuze:downloadurl>" );
   
        DownloadScrapeResult scrape = download.getLastScrapeResult();
View Full Code Here

Examples of org.gudy.azureus2.plugins.torrent.Torrent

    Object[]  params  = request.getParams();
   
    if ( method.equals( "host[Torrent,boolean]")){
     
      try{
        Torrent  torrent = params[0]==null?null:(Torrent)((RPTorrent)params[0])._setLocal();
       
        if ( torrent == null ){
         
          throw( new RPException( "Invalid torrent" ));
        }
View Full Code Here

Examples of org.gudy.azureus2.plugins.torrent.Torrent

       
        Download hit = null;
       
        for ( Download download: downloads ){
         
          Torrent torrent = download.getTorrent();
         
          if ( torrent != null && torrent.isSimpleTorrent()){
           
            String name = torrent.getFiles()[0].getName();
           
            if ( name.startsWith( "aefeatman_v_") && name.endsWith( ".zip" )){
             
              hit = download;
             
View Full Code Here

Examples of org.gudy.azureus2.plugins.torrent.Torrent

     
      return( 0 );
    }
   
    try{
      Torrent t = manager.getDownload().getTorrent();
     
      if ( t == null ){
       
        return( Long.MAX_VALUE );
      }
     
      return(( t.getSize() * rem_pm ) / 1000 );
     
    }catch( Throwable e ){
     
      return( Long.MAX_VALUE );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.