1 18 package net.sf.drftpd.slave; 19 20 import java.io.Serializable ; 21 import java.net.InetAddress ; 22 23 27 public class TransferStatus implements Serializable { 28 private long _checksum; 29 private long _elapsed, _transfered; 30 private InetAddress _peer; 31 32 public TransferStatus(long elapsed, long transfered, long checksum, InetAddress peer) { 33 _elapsed = elapsed; 34 _transfered = transfered; 35 _checksum = checksum; 36 if(peer == null) throw new NullPointerException (); 37 _peer = peer; 38 } 39 40 public long getChecksum() { 41 return _checksum; 42 } 43 44 47 public long getElapsed() { 48 return _elapsed; 49 } 50 51 54 public long getTransfered() { 55 return _transfered; 56 } 57 58 61 public int getXferSpeed() { 62 if (_transfered == 0) 63 return 0; 64 if (_elapsed == 0) 65 return 0; 66 return (int) (_transfered / ((float) _elapsed / (float) 1000)); 67 } 68 69 public InetAddress getPeer() { 70 return _peer; 71 } 72 73 } 74 | Popular Tags |