Skip to content

Commit

Permalink
add custom GridSampleDimensionSerializer
Browse files Browse the repository at this point in the history
  • Loading branch information
prantogg committed Apr 26, 2024
1 parent b1103bf commit f5b8923
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,17 @@ public static byte[] serializeGridSampleDimension(GridSampleDimension sampleDime
Kryo kryo = kryos.get();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Output output = new Output(baos);
kryo.writeClassAndObject(output, sampleDimension);
GridSampleDimensionSerializer serializer = new GridSampleDimensionSerializer();
serializer.write(kryo, output, sampleDimension);
output.close();
return baos.toByteArray();
}

public static GridSampleDimension deserializeGridSampleDimension(byte[] data) {
Kryo kryo = kryos.get();
Input input = new Input(new ByteArrayInputStream(data));
return (GridSampleDimension) kryo.readClassAndObject(input);
GridSampleDimensionSerializer serializer = new GridSampleDimensionSerializer();
return serializer.read(kryo, input, GridSampleDimension.class);
}

}

0 comments on commit f5b8923

Please sign in to comment.