public void testBinary() {
File tmpfile;
try {
tmpfile = File.createTempFile("hadooprec", ".dat");
FileOutputStream ostream = new FileOutputStream(tmpfile);
RecordWriter out = new RecordWriter(ostream, "binary");
RecRecord1 r1 = new RecRecord1();
r1.setBoolVal(true);
r1.setByteVal((byte)0x66);
r1.setFloatVal(3.145F);
r1.setDoubleVal(1.5234);
r1.setIntVal(4567);
r1.setLongVal(0x5a5a5a5a5a5aL);
r1.setStringVal(new Text("random text"));
r1.setBufferVal(new BytesWritable());
r1.setVectorVal(new ArrayList());
r1.setMapVal(new TreeMap());
RecRecord0 r0 = new RecRecord0();
r0.setStringVal(new Text("other random text"));
r1.setRecordVal(r0);
out.write(r1);
ostream.close();
FileInputStream istream = new FileInputStream(tmpfile);
RecordReader in = new RecordReader(istream, "binary");
RecRecord1 r2 = new RecRecord1();
in.read(r2);