ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
try {
KeyValue.write(input, dos);
} catch (IOException e) {
throw new CrunchRuntimeException(e);
}
return new BytesWritable(baos.toByteArray());
}