Created
August 11, 2014 22:32
-
-
Save okram/fbd5cb92df39152cbf2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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