⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 downloadmanager.java

📁 这是一个基于java编写的torrent的P2P源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
  	 * state, even if it has no data.  
  	 * <p>
  	 * When the torrent starts up, the real complete
  	 * level will be checked, and if the torrent
  	 * actually does have missing data, the download will be thrown
  	 * into error state.
  	 * <p>
  	 * Only a forced-recheck should clear this flag.
  	 * 
  	 * @see {@link #requestAssumedCompleteMode()}
  	 */
    public boolean
    getAssumedComplete();

    /**
     * Will set this download to be "assumed complete" for if the download
     * is already complete (excluding DND)
     * 
     * @return true- success; false- failure, download not complete
     */
    public boolean
    requestAssumedCompleteMode();

    /**
     * @return the wealthy status of this download
     */
    public int getHealthStatus();

    /**
     * See plugin ConnectionManager.NAT_ constants for return values
     * @return
     */

     public int
     getNATStatus();

        /**
         * persist resume data
         *
         */

    public void
    saveResumeData();

        /**
         * persist any general download related information, excluding resume data which is
         * managed separately by saveResumeData
         */

    public void
    saveDownload();

      /** To retreive arbitrary objects against this object. */
    public Object getData (String key);
      /** To store arbitrary objects against this object. */
    public void setData (String key, Object value);


      /**
       * Determine whether disk allocation has already been done.
       * Used for checking if data is missing on a previously-loaded torrent.
       * @return true if data files have already been allocated
       */
    public boolean isDataAlreadyAllocated();

      /**
       * Set whether data allocation has already been done, so we know
       * when to allocate and when to throw a missing-data error message.
       * @param already_allocated
       */

    public void setDataAlreadyAllocated( boolean already_allocated );


    public void setSeedingRank(int rank);

    public int getSeedingRank();

    public void setMaxUploads( int max_slots );
    
    public int getMaxUploads();
    
	/**
	 * Returns the max uploads depending on whether the download is seeding and it has a separate
	 * rate for this
	 * @return
	 */

	public int
	getEffectiveMaxUploads();

        /**
         * returns the currently in force upload speed limit which may vary from the stats. value
         * as this gives the fixed per-torrent limit
         * @return
         */

    public int
    getEffectiveUploadRateLimitBytesPerSecond();

        /**
         * Move data files to new location. Torrent must be in stopped/error state
         * @param new_parent_dir
         * @return
         */

    public void
    moveDataFiles(
        File    new_parent_dir )

        throws DownloadManagerException;
    
    /**
     * Rename the download - this means the name of the file being downloaded (for single
     * file torrents), or the name of the directory holding the files (in a multi-file torrent).
     * 
     * This does not alter the displayed name of the download.
     * 
     * @param new_name
     * @throws DownloadManagerException
     */
    public void renameDownload(String new_name) throws DownloadManagerException;

        /**
         * Move torrent file to new location. Download must be stopped/error
         * @param new_parent_dir
         * @return
         */

    public void
    moveTorrentFile(
        File    new_parent_dir )

        throws DownloadManagerException;

    /**
     * Returns an array of size 2 indicating the appropriate locations for this
     * download's data files and torrent file, based on Azureus's rules regarding
     * default save paths, and move on completion rules.
     * 
     * This method takes one argument - <i>for_moving</i>. This essentially
     * indicates whether you are getting this information for purposes of just
     * finding where Azureus would store these files by default, or whether you
     * are considering moving the files from its current location.
     * 
     * If <i>for_moving</i> is <tt>false</tt>, this method will determine locations
     * for the download and the torrent file where Azureus would store them by
     * default (it may return the current paths used by this download). 
     * 
     * If <i>for_moving</i> is <tt>true</tt>, then this method will consider the
     * download's current location, and whether it is allowed to move it - you
     * may not be allowed to move this download (based on Azureus's current rules)
     * if the download doesn't exist within a default save directory already. If
     * a download is complete, we consider whether we are allowed to move downloads
     * on completion, and whether that includes downloads outside the default save
     * directory.
     * 
     * In this case, the array may contain <tt>null</tt> indicating that the Azureus
     * doesn't believe that the download should be moved (based on the current rules
     * the user has set out). However, you are not prevented from changing the
     * location of the torrent file or download.
     * 
     * @since 2.5.0.2
     * @param for_moving Indicates whether you want this information for the purposes
     *     of moving the download or not.
     * @author amc1
     * @return An array of type <tt>File</tt> of size 2, first element containing the
     *     calculated location for the download's data files, and the second element
     *     containing the location for the download's torrent file.
     */
    public File[] calculateDefaultPaths(boolean for_moving);
    
    /**
     * Returns <tt>true</tt> if the download is being saved to one of the default
     * save directories.
     * 
     * @since 2.5.0.2
     */
    public boolean isInDefaultSaveDir();
    
        /**
         * gives the time this download was created (not the torrent but the download itself)
         * @return
         */

    public long
    getCreationTime();

    public void
    setCreationTime(
            long        t );

    public void
    setAnnounceResult(
        DownloadAnnounceResult  result );

    public void
    setScrapeResult(
        DownloadScrapeResult    result );

  /**
   * Is advanced AZ messaging enabled for this download.
   * @return true if enabled, false if disabled
   */
    public boolean isAZMessagingEnabled();

  /**
   * Enable or disable advanced AZ messaging for this download.
   * @param enable true to enabled, false to disabled
   */
    public void setAZMessagingEnabled( boolean enable );

        /**
         * Indicates that the download manager is no longer needed
         * @param is_duplicate indicates whether this dm is being destroyed because it is a duplicate 
         */

    public void
    destroy(
    	boolean	is_duplicate );

    public PEPiece[]
    getCurrentPieces();

    public PEPeer[]
    getCurrentPeers();

    	/**
    	 * Gives the download an opportunity to schedule seeding mode piece rechecks if desired
    	 * @return true if a piece has been rechecked
    	 */
    
	public boolean
	seedPieceRecheck();
	
    public void
    addListener(
            DownloadManagerListener listener );

    public void
    removeListener(
            DownloadManagerListener listener );

    public void
    addTrackerListener(
        DownloadManagerTrackerListener  listener );

    public void
    removeTrackerListener(
        DownloadManagerTrackerListener  listener );

    public void
    addPeerListener(
        DownloadManagerPeerListener listener );

    public void
    addPeerListener(
        DownloadManagerPeerListener listener,
        boolean bDispatchForExisting );

    public void
    removePeerListener(
        DownloadManagerPeerListener listener );

    public void
    addDiskListener(
        DownloadManagerDiskListener listener );

    public void
    removeDiskListener(
        DownloadManagerDiskListener listener );

    public int
    getActivationCount();
    
    public void
    addActivationListener(
    	DownloadManagerActivationListener listener );

    public void
    removeActivationListener(
    	DownloadManagerActivationListener listener );

    
    public void
    generateEvidence(
        IndentWriter        writer );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -