MCPcopy Create free account
hub / github.com/MenoData/Time4J / roundtrip

Method roundtrip

base/src/test/java/net/time4j/calendar/NengoTest.java:282–295  ·  view source on GitHub ↗
(Object obj)

Source from the content-addressed store, hash-verified

280 }
281
282 private static int roundtrip(Object obj)
283 throws IOException, ClassNotFoundException {
284
285 ByteArrayOutputStream baos = new ByteArrayOutputStream();
286 ObjectOutputStream oos = new ObjectOutputStream(baos);
287 oos.writeObject(obj);
288 byte[] data = baos.toByteArray();
289 oos.close();
290 ByteArrayInputStream bais = new ByteArrayInputStream(data);
291 ObjectInputStream ois = new ObjectInputStream(bais);
292 assertThat(ois.readObject() == obj, is(true)); // identity check
293 ois.close();
294 return data.length;
295 }
296
297 private static PlainDate convert(String date) {
298 String[] components = date.split("-");

Callers 1

serializationMethod · 0.95

Calls 2

closeMethod · 0.80
readObjectMethod · 0.45

Tested by

no test coverage detected