return Arrays.copyOf(buffer.getData(), buffer.getLength());
}
static <T extends Writable> T read(T writable, byte[] bytes) {
DataInputBuffer buffer = new DataInputBuffer();
buffer.reset(bytes, bytes.length);
try {
writable.readFields(buffer);
assertThat("Enf of Stream", buffer.read(), is(-1));
} catch (IOException e) {
throw new AssertionError(e);