MCPcopy Create free account
hub / github.com/cschanck/single-file-java / Encoder

Interface Encoder

src/main/java/org/sfj/PojoClientServer.java:55–66  ·  view source on GitHub ↗

Encoder interface. Turn an object into a byte[].

Source from the content-addressed store, hash-verified

53 * Encoder interface. Turn an object into a byte[].
54 */
55 @FunctionalInterface
56 interface Encoder {
57 Encoder SERIALIZE = (m) -> {
58 ByteArrayOutputStream baos = new ByteArrayOutputStream();
59 ObjectOutputStream oos = new ObjectOutputStream(baos);
60 oos.writeUnshared(m);
61 oos.flush();
62 return baos.toByteArray();
63 };
64
65 byte[] encode(Object msg) throws IOException;
66 }
67
68 /**
69 * Decoder interface. Turn a single byte[] into an object.

Callers 2

appendMethod · 0.65
sendNoLockMethod · 0.65

Calls 1

flushMethod · 0.45

Tested by

no test coverage detected