Package com.aelitis.azureus.plugins.extseed.util

Examples of com.aelitis.azureus.plugins.extseed.util.ExternalSeedHTTPDownloaderLinear


   
    if ( to_torrent.isSimpleTorrent()){
     
      http_downloaders =
        new ExternalSeedHTTPDownloader[]{
          linear_download?new ExternalSeedHTTPDownloaderLinear( url, ua ):new ExternalSeedHTTPDownloaderRange( url, ua )};
     
      downloader_offsets   = new long[]{ 0 };
      downloader_lengths  = new long[]{ to_torrent.getSize() };
     
    }else{
     
      TOTorrentFile[]  files = to_torrent.getFiles();
     
      http_downloaders = new ExternalSeedHTTPDownloader[ files.length ];
     
      downloader_offsets   = new long[ files.length ];
      downloader_lengths  = new long[ files.length ];

      long  offset  = 0;
     
        // encoding is a problem, assume ISO-8859-1
     
      String  base_url = url.toString();
     
      if ( base_url.endsWith( "/" )){
       
        base_url = base_url.substring( 0, base_url.length()-1 );
      }
     
      base_url += "/" + URLEncoder.encode( new String( to_torrent.getName(), "ISO-8859-1" ), "ISO-8859-1" ).replaceAll("\\+", "%20");
     
      for (int i=0;i<files.length;i++ ){
       
        TOTorrentFile  file = files[i];
       
        long length = file.getLength();
         
        String  file_url_str = base_url;
       
        byte[][] bits = file.getPathComponents();
       
        for (int j=0;j<bits.length;j++){
         
          file_url_str += "/" + URLEncoder.encode( new String( bits[j], "ISO-8859-1" ), "ISO-8859-1" ).replaceAll("\\+", "%20");
        }
       
        http_downloaders[i] = linear_download?new ExternalSeedHTTPDownloaderLinear( new URL( file_url_str), ua ):new ExternalSeedHTTPDownloaderRange( new URL( file_url_str), ua );
       
        downloader_offsets[i= offset;
        downloader_lengths[i= length;
       
        offset += length;
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.plugins.extseed.util.ExternalSeedHTTPDownloaderLinear

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.