TestJoinTupleWritable.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:hadoop 作者:
public void testWideWritable() throws Exception {
  Writable[] manyWrits = makeRandomWritables(131);

  TupleWritable sTuple = new TupleWritable(manyWrits);
  for (int i =0; i<manyWrits.length; i++)
  {
    if (i % 3 == 0) {
      sTuple.setWritten(i);
    }
  }
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  sTuple.write(new DataOutputStream(out));
  ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
  TupleWritable dTuple = new TupleWritable();
  dTuple.readFields(new DataInputStream(in));
  assertTrue("Failed to write/read tuple", sTuple.equals(dTuple));
  assertEquals("All tuple data has not been read from the stream", 
    -1, in.read());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号