有上图这样的文件,需要统计每个用户使用的上行总流量,下行总流量和总流量
第一步:创建一个用户类如下:
package com.zut.flow;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import org.apache.hadoop.io.Writable;
public class Flow implements Writable{
private String tel;
private long up;
private long dw;
private long total;
public Flow() {
super();
}
public Flow(long up, long dw, long total) {
super();
this.up = up;
this.dw = dw;
this.total = total;
}
public Flow(String tel, long up, long dw, long total) {
super();
this.tel = tel;
this.up = up;
this.dw = dw;
this.total = total;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public long getUp() {
return up;
}
public void setUp(long up) {
this.up = up;
}
p