@Override public DataInputBuffer getKey() throws IOException { ByteArrayOutputStream dt = new ByteArrayOutputStream(); GridmixKey key = new GridmixKey(GridmixKey.REDUCE_SPEC, 10 * counter, 1L); Spec spec = new Spec(); spec.rec_in = counter; spec.rec_out = counter; spec.bytes_out = counter * 100; key.setSpec(spec); key.write(new DataOutputStream(dt)); DataInputBuffer result = new DataInputBuffer(); byte[] b = dt.toByteArray(); result.reset(b, 0, b.length); return result; }