Created
April 22, 2014 21:24
-
-
Save okram/11194881 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
public static class Marko implements Serializable { | |
public Function<Integer, Integer> function = (Function & Serializable) a -> 1 + 5; | |
} | |
@Test | |
public void testLambdaSerialization() throws Exception { | |
//System.out.println(function.getClass().isLocalClass()); | |
/*byte[] bytes = Serializer.serializeObject(new Marko()); | |
FileOutputStream outputStream = new FileOutputStream("/tmp/function.bin"); | |
outputStream.write(bytes); | |
outputStream.flush(); | |
outputStream.close();*/ | |
byte[] bytes = new byte[(int) new File("/tmp/function.bin").length()]; | |
FileInputStream inputStream = new FileInputStream("/tmp/function.bin"); | |
new DataInputStream(inputStream).readFully(bytes); | |
System.out.println(((Marko)Serializer.deserializeObject(bytes)).function.apply(2)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment