Skip to content

Instantly share code, notes, and snippets.

@okram
Created August 11, 2014 22:32
Show Gist options
  • Save okram/fbd5cb92df39152cbf2a to your computer and use it in GitHub Desktop.
Save okram/fbd5cb92df39152cbf2a to your computer and use it in GitHub Desktop.
@Test
public void shouldSerializeObject2() throws Exception {
TraversalCounterMessage traverser = new TraversalCounterMessage();
traverser.setCounter(10l);
KryoWritable writable = new KryoWritable<>(traverser);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
final DataOutput out = new DataOutputStream(outputStream);
writable.write(out);
final byte[] objectBytes = new byte[outputStream.size()];
for (int i = 0; i < outputStream.size(); i++) {
objectBytes[i] = outputStream.toByteArray()[i];
}
final DataInput in = new DataInputStream(new ByteArrayInputStream(objectBytes));
writable = new KryoWritable<>();
writable.readFields(in);
//assertEquals(writable.get(), "marko");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment