org.alliance.core.comm.filetransfers
Class DownloadConnection

java.lang.Object
  extended by org.alliance.core.comm.Connection
      extended by org.alliance.core.comm.PacketConnection
          extended by org.alliance.core.comm.AuthenticatedConnection
              extended by org.alliance.core.comm.filetransfers.TransferConnection
                  extended by org.alliance.core.comm.filetransfers.DownloadConnection

public class DownloadConnection
extends TransferConnection

Created by IntelliJ IDEA. User: maciek Date: 2006-jan-26 Time: 21:36:37 To change this template use File | Settings | File Templates.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.alliance.core.comm.filetransfers.TransferConnection
TransferConnection.Command, TransferConnection.Mode, TransferConnection.TransferDirection
 
Nested classes/interfaces inherited from class org.alliance.core.comm.Connection
Connection.Direction
 
Field Summary
static int CONNECTION_ID
           
 
Fields inherited from class org.alliance.core.comm.filetransfers.TransferConnection
mode
 
Fields inherited from class org.alliance.core.comm.AuthenticatedConnection
remoteUserGUID
 
Fields inherited from class org.alliance.core.comm.Connection
bandwidthIn, bandwidthOut, bytesReceived, bytesSent, connected, core, direction, hasWriteInterest, key, netMan, statusString
 
Constructor Summary
DownloadConnection(NetworkManager netMan, Connection.Direction direction, int userGUID, Download download)
           
 
Method Summary
 void blockDownloadComplete(int blockNumber)
           
 void bytesReceived(int n)
           
 void close()
          Close this connection
 void fileDescriptorReceived()
           
protected  int getConnectionId()
           
 int getConnectionIdForRemote()
           
 Download getDownload()
           
 Hash getRoot()
           
 void init()
           
 boolean isDownloading()
           
 boolean isDownloadingBlock()
           
 boolean isDownloadingFd()
           
 void packetReceived(Packet p)
           
 boolean readyToStartDownload()
           
 void received(java.nio.ByteBuffer buf)
           
 void sendGetFD()
           
 void sendGracefulClose()
           
 void startDownloadingBlock()
           
 java.lang.String toString()
           
 
Methods inherited from class org.alliance.core.comm.filetransfers.TransferConnection
sendCommand, switchMode
 
Methods inherited from class org.alliance.core.comm.AuthenticatedConnection
getRemoteFriend, getRemoteUserGUID, getSocketAddress, newInstance, sendConnectionIdentifier, setRemoteUserGUID
 
Methods inherited from class org.alliance.core.comm.PacketConnection
getLastPacketSentAt, getPacketsReceived, readyToSend, send
 
Methods inherited from class org.alliance.core.comm.Connection
bytesSent, getBandwidthIn, getBandwidthOut, getBytesReceived, getBytesSent, getDirection, getKey, getNetMan, getStatusString, hasWriteInterest, isConnected, setHasWriteInterest, setKey, setStatusString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONNECTION_ID

public static final int CONNECTION_ID
See Also:
Constant Field Values
Constructor Detail

DownloadConnection

public DownloadConnection(NetworkManager netMan,
                          Connection.Direction direction,
                          int userGUID,
                          Download download)
Method Detail

getRoot

public Hash getRoot()
Specified by:
getRoot in class TransferConnection

init

public void init()
          throws java.io.IOException
Overrides:
init in class AuthenticatedConnection
Throws:
java.io.IOException

bytesReceived

public void bytesReceived(int n)
Overrides:
bytesReceived in class Connection

sendGetFD

public void sendGetFD()
               throws java.io.IOException
Throws:
java.io.IOException

sendGracefulClose

public void sendGracefulClose()
                       throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Description copied from class: Connection
Close this connection

Overrides:
close in class Connection
Throws:
java.io.IOException

received

public void received(java.nio.ByteBuffer buf)
              throws java.io.IOException
Overrides:
received in class PacketConnection
Throws:
java.io.IOException

packetReceived

public void packetReceived(Packet p)
                    throws java.io.IOException
Specified by:
packetReceived in class PacketConnection
Throws:
java.io.IOException

getConnectionId

protected int getConnectionId()
Specified by:
getConnectionId in class Connection

getConnectionIdForRemote

public int getConnectionIdForRemote()
Overrides:
getConnectionIdForRemote in class Connection

isDownloadingFd

public boolean isDownloadingFd()

isDownloadingBlock

public boolean isDownloadingBlock()

blockDownloadComplete

public void blockDownloadComplete(int blockNumber)
                           throws java.io.IOException
Throws:
java.io.IOException

startDownloadingBlock

public void startDownloadingBlock()
                           throws java.io.IOException
Throws:
java.io.IOException

getDownload

public Download getDownload()

isDownloading

public boolean isDownloading()

readyToStartDownload

public boolean readyToStartDownload()

fileDescriptorReceived

public void fileDescriptorReceived()

toString

public java.lang.String toString()
Overrides:
toString in class AuthenticatedConnection