MCPcopy Create free account
hub / github.com/SeanDragon/protools / ToolSerialize

Class ToolSerialize

common/src/main/java/pro/tools/data/ToolSerialize.java:10–34  ·  view source on GitHub ↗

序列化操作 @author SeanDragon

Source from the content-addressed store, hash-verified

8 * @author SeanDragon
9 */
10public final class ToolSerialize {
11
12 private ToolSerialize() {
13 throw new UnsupportedOperationException("我是工具类,别初始化我。。。");
14 }
15
16 private static FSTConfiguration CONFIGURATION = FSTConfiguration
17 .createDefaultConfiguration();
18
19 public static <T> byte[] serialize(T value) {
20 return CONFIGURATION.asByteArray(value);
21 }
22
23 public static <T> T unserialize(byte[] bytes) {
24 return (T) CONFIGURATION.asObject(bytes);
25 }
26
27 public static synchronized FSTConfiguration getCONFIGURATION() {
28 return CONFIGURATION;
29 }
30
31 public static synchronized void setCONFIGURATION(FSTConfiguration configuration) {
32 ToolSerialize.CONFIGURATION = configuration;
33 }
34}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected