generated from root/miduo_server
反序列化
parent
ed58227588
commit
57cbc38a10
|
@ -18,7 +18,7 @@ public class JsonUtil {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(JsonUtil.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(JsonUtil.class);
|
||||||
private static JsonUtil jsonUtil;
|
private static JsonUtil jsonUtil;
|
||||||
|
|
||||||
private Gson gson = new Gson();
|
private static Gson gson = new Gson();
|
||||||
|
|
||||||
private static class InnerClass {
|
private static class InnerClass {
|
||||||
private static final JsonUtil SINGLETON = new JsonUtil();
|
private static final JsonUtil SINGLETON = new JsonUtil();
|
||||||
|
@ -68,12 +68,13 @@ public class JsonUtil {
|
||||||
|
|
||||||
|
|
||||||
public static HaoGameParamBean serializeToObject(String str) throws IOException, ClassNotFoundException {
|
public static HaoGameParamBean serializeToObject(String str) throws IOException, ClassNotFoundException {
|
||||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(str.getBytes("UTF-8"));
|
// ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(str.getBytes("UTF-8"));
|
||||||
ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
|
// ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
|
||||||
HaoGameParamBean object = (HaoGameParamBean) objectInputStream.readObject();
|
// HaoGameParamBean object = (HaoGameParamBean) objectInputStream.readObject();
|
||||||
objectInputStream.close();
|
// objectInputStream.close();
|
||||||
byteArrayInputStream.close();
|
// byteArrayInputStream.close();
|
||||||
return object;
|
HaoGameParamBean haoGameParamBean = gson.fromJson(str, HaoGameParamBean.class);
|
||||||
|
return haoGameParamBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortedMap<String, String> getParameterMapYX(HttpServletRequest request) {
|
public SortedMap<String, String> getParameterMapYX(HttpServletRequest request) {
|
||||||
|
|
Loading…
Reference in New Issue