kryo-serializers icon indicating copy to clipboard operation
kryo-serializers copied to clipboard

Serializer for java.io.File

Open shevek opened this issue 10 years ago • 0 comments

      kryo.register(File.class, new Serializer<File>() {
            @Override
            public void write(Kryo kryo, Output output, File object) {
                output.writeString(object.getPath());
            }

            @Override
            public File read(Kryo kryo, Input input, Class type) {
                return new File(input.readString());
            }
        });

shevek avatar Sep 22 '14 23:09 shevek