View Javadoc

1   package org.kuali.maven.wagon;
2   
3   /**
4    * Holds timing and byte count information about a transfer operation
5    * 
6    * @author Jeff Caddel
7    * 
8    * @since May 27, 2010 6:51:19 PM
9    */
10  public class TransferTracker {
11  	long initiated;
12  	long started;
13  	long completed;
14  	int byteCount;
15  	SimpleFormatter formatter = new SimpleFormatter();
16  
17  	public long getInitiated() {
18  		return initiated;
19  	}
20  
21  	public void setInitiated(long initiated) {
22  		this.initiated = initiated;
23  	}
24  
25  	public long getStarted() {
26  		return started;
27  	}
28  
29  	public void setStarted(long started) {
30  		this.started = started;
31  	}
32  
33  	public long getCompleted() {
34  		return completed;
35  	}
36  
37  	public void setCompleted(long completed) {
38  		this.completed = completed;
39  	}
40  
41  	public int getByteCount() {
42  		return byteCount;
43  	}
44  
45  	public void setByteCount(int byteCount) {
46  		this.byteCount = byteCount;
47  	}
48  
49  	public String toString() {
50  		long elapsed = completed - started;
51  		StringBuffer sb = new StringBuffer();
52  		sb.append("[" + formatter.getTime(elapsed));
53  		sb.append(", " + formatter.getSize(byteCount));
54  		sb.append(", " + formatter.getRate(elapsed, byteCount));
55  		sb.append("]");
56  		return sb.toString();
57  	}
58  }