Package org.gudy.azureus2.core3.torrent

Examples of org.gudy.azureus2.core3.torrent.TOTorrent


              // let's verify the torrent
           
            byte[]  data = (byte[])value.getValue(byte[].class);

            try{
              TOTorrent torrent = TOTorrentFactory.deserialiseFromBEncodedByteArray( data );
             
              if ( Arrays.equals( hash, torrent.getHash())){
             
                listener.reportContributor( contact.getAddress());
           
                return( data );
               
View Full Code Here


    if ( x instanceof InputStream ){
     
      InputStream is = (InputStream)x;
       
      try{
        TOTorrent t = TOTorrentFactory.deserialiseFromBEncodedInputStream( is );
       
        TorrentUtils.setPeerCacheValid( t );
   
        return( BEncoder.encode( t.serialiseToMap()));
       
      }catch( Throwable e ){             
      }
    }else if ( x instanceof ResourceDownloaderException ){
     
View Full Code Here

  public static void
  main(
    String[]  args )
  {
    try{
      TOTorrent torrent = TOTorrentFactory.deserialiseFromBEncodedFile( new File( "C:\\temp\\test.torrent" ));
     
      CachePeer[]  peers = new CLCacheDiscovery().lookup( torrent );
     
      System.out.println( "peers=" + peers.length );
     
View Full Code Here

    }
    setID(MapUtils.getMapString(map, "id", null));
    setText(MapUtils.getMapString(map, "text", null));
    Map torrentMap = MapUtils.getMapMap(map, "torrent", null);
    if (torrentMap != null) {
      TOTorrent torrent = null;
      try {
        torrent = TOTorrentFactory.deserialiseFromMap(torrentMap);
        setTorrent(torrent);
      } catch (TOTorrentException e) {
      }
View Full Code Here

      try {
        // make a copy of the torrent

        Map torrent_map = torrent.serialiseToMap();
       
        TOTorrent torrent_to_send = TOTorrentFactory.deserialiseFromMap( torrent_map );

        Map  vuze_map = (Map)torrent_map.get( "vuze" );
       
        // remove any non-standard stuff (e.g. resume data)

        torrent_to_send.removeAdditionalProperties();

        torrent_map = torrent_to_send.serialiseToMap();
       
        if ( vuze_map != null ){
         
          torrent_map.put( "vuze", vuze_map );
        }
View Full Code Here

      }
    }

    sc.setDisplayName(getTorrentName());
    if (sc.getDisplayName() == null) {
      TOTorrent torrent = getTorrent();
      if (torrent != null) {
        sc.setDisplayName(TorrentUtils.getLocalisedName(torrent));
        sc.setHash(torrent.getHashWrapper().toBase32String(), ourContent);
      }
    }
   
    if (sc.getHash() == null ){
     
View Full Code Here

   
    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()){
             
View Full Code Here

      //delete torrents from the previous import run

      for (int i = 0; i < to_delete.size(); i++) {

        TOTorrent torrent = (TOTorrent) to_delete.get(i);

        try {
          TorrentUtils.delete(torrent);

        } catch (Throwable e) {

          Debug.printStackTrace(e);
        }
      }

      to_delete.clear();

      String[] currentFileList = folder.list(filename_filter);
      if (currentFileList == null) {
        Logger.log(new LogEvent(LOGID, LogEvent.LT_ERROR,
            "There was a problem trying to get a listing of torrents from " + folder));
        return;
      }

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

        File file = new File(folder, currentFileList[i]);

        // make sure we've got a valid torrent file before proceeding

        try {

          TOTorrent torrent = TorrentUtils.readFromFile(file, false);

          if (global_manager.getDownloadManager(torrent) != null) {

            if (Logger.isEnabled())
              Logger.log(new LogEvent(LOGID, file.getAbsolutePath()
                  + " is already being downloaded"));

            // we can't touch the torrent file as it is (probably)
            // being used for the download

          } else {
           
            byte[] hash = null;
            try {
              hash = torrent.getHash();
            } catch (Exception e) { }

            if (!save_torrents) {

              File imported = new File(folder, file.getName() + ".imported");
View Full Code Here

              d.setLastRequestTime( now );
            }
          }
        }
       
        TOTorrent  torrent = request.getFile().getTorrentFile().getTorrent();
           
        dispatcher = (requestDispatcher)torrent_dispatcher_map.get(torrent);     
 
        if ( dispatcher == null ){
         
View Full Code Here

                        TOTorrentFactory.createFromFileOrDirWithFixedPieceLength(
                            data_location,
                            announce_url,
                            256*1024 );
                 
                      TOTorrent t = creator.create();
                     
                      t.setHashOverride( hash );
                     
                      return( t );
                    }
                  });
            }
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.torrent.TOTorrent

Copyright © 2018 www.massapicom. 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.