edu.isi.nlp.serialization.jackson.JacksonTestUtils Maven / Gradle / Ivy
The newest version!
package edu.isi.nlp.serialization.jackson;
import com.google.common.io.ByteSource;
import edu.isi.nlp.io.ByteArraySink;
import java.io.IOException;
public final class JacksonTestUtils {
private JacksonTestUtils() {
throw new UnsupportedOperationException();
}
public static T roundTripThroughSerializer(final T o, final JacksonSerializer jackson)
throws IOException {
final ByteArraySink sink = ByteArraySink.create();
jackson.serializeTo(o, sink);
final ByteSource source = ByteSource.wrap(sink.toByteArray());
return (T) jackson.deserializeFrom(source);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy