static class UserAndPostWritable implements Writable
{
/**
* 类型 U表示用户,P表示帖子
*/
private String type;
private String data;
public UserAndPostWritable()
{
}
public UserAndPostWritable(String type, String data)
{
super();
this.type = type;
this.data = data;
}
public String getType()
{
return type;
}
public void setType(String type)
{
this.type = type;
}
public String getData()
{
return data;
}
public void setData(String data)
{
this.data = data;
}
@Override
public void readFields(DataInput input) throws IOException
{
type = input.readUTF();
data = input.readUTF();
}
@Override
public void write(DataOutput output) throws IOException
{
output.writeUTF(type);
output.writeUTF(data);
}
}
mapreduce实现writable接口自定义输出格式
最新推荐文章于 2022-04-18 16:26:39 发布