Kryoを使用して、いくつかのオブジェクトのリストのリスト(カスタマイズされたクラスのリスト:List>)をシリアル化しようとしています。
list2D; // List<List<MyClass>> which is already produced.
Kryo k1 = new Kryo();
Output output = new Output(new FileOutputStream("filename.ser"));
k1.writeObject(output, (List<List<Myclass>>) list2D);
output.close();
これまでのところ問題なく、エラーなしでリストを書き出します。しかし、私がそれを読み込もうとすると:
Kryo k2 = new Kryo();
Input listRead = new Input(new FileInputStream("filename.ser"));
List<List<Myclass>> my2DList = (List<List<Myclass>>) k2.readObject(listRead, List.class);
このエラーが発生します:
Exception in thread "main" com.esotericsoftware.kryo.KryoException: Class cannot be created (missing no-arg constructor): java.util.List
どうすればこの問題を解決できますか?