AzureusPeerDownload.java
| Index Score | ||
|---|---|---|
![]() |
![]() |
org.xnap.plugin.azureus |
![]() |
![]() |
XNap 3 |
View: Reasons, Metrics, Source Code
These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.
| Metric | Description | |
|---|---|---|
/*
* XNap - A P2P framework and client.
*
* See the file AUTHORS for copyright information.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.xnap.plugin.azureus;
import java.io.File;
import javax.swing.Action;
import org.apache.log4j.Logger;
import org.gudy.azureus2.core3.peer.PEPeer;
import org.xnap.XNap;
import org.xnap.peer.Peer;
import org.xnap.plugin.Plugin;
import org.xnap.transfer.AbstractTransfer;
import org.xnap.transfer.Download;
/**
* Downloads a file.
*/
public class AzureusPeerDownload extends AbstractTransfer implements Download {
//--- Constant(s) ---
//--- Data field(s) ---
private static Logger logger = Logger.getLogger(AzureusPeerDownload.class);
private AzureusDownloadContainer parent;
private PEPeer peer;
//--- Constructor(s) ---
public AzureusPeerDownload(AzureusDownloadContainer parent, PEPeer peer)
{
this.parent = parent;
this.peer = peer;
}
//--- Method(s) ---
public long getBytesTransferred()
{
return peer.getStats().getTotalReceived();
}
public Action[] getActions()
{
return null;
}
public File getFile()
{
return parent.getFile();
}
public String getFilename()
{
return parent.getFilename();
}
public long getFilesize()
{
return parent.getFilesize();
}
public Peer getPeer()
{
return null;
}
public Plugin getPlugin()
{
return AzureusPlugin.getInstance();
}
public String getStatus()
{
switch (peer.getState()) {
case PEPeer.CONNECTING :
return XNap.tr("Connecting");
case PEPeer.DISCONNECTED :
return XNap.tr("Disconnected");
case PEPeer.HANDSHAKING :
return XNap.tr("Handshaking");
case PEPeer.TRANSFERING :
return XNap.tr("Downloading");
default:
return XNap.tr("Unknown State {0}", peer.getState());
}
}
public long getTotalBytesTransferred()
{
return getBytesTransferred();
}
public boolean isDone()
{
int s = peer.getState();
return s == PEPeer.DISCONNECTED;
}
public boolean isRunning()
{
int s = peer.getState();
return s == PEPeer.TRANSFERING;
}
//--- Inner Class(es) ---
}
The table below shows all metrics for AzureusPeerDownload.java.
| Metric | Value | Description | |
|---|---|---|---|



