序列化操作 @author SeanDragon
| 8 | * @author SeanDragon |
| 9 | */ |
| 10 | public 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected