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 JsonUtil jsonUtil;
|
||||
|
||||
private Gson gson = new Gson();
|
||||
private static Gson gson = new Gson();
|
||||
|
||||
private static class InnerClass {
|
||||
private static final JsonUtil SINGLETON = new JsonUtil();
|
||||
|
@ -68,12 +68,13 @@ public class JsonUtil {
|
|||
|
||||
|
||||
public static HaoGameParamBean serializeToObject(String str) throws IOException, ClassNotFoundException {
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(str.getBytes("UTF-8"));
|
||||
ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
|
||||
HaoGameParamBean object = (HaoGameParamBean) objectInputStream.readObject();
|
||||
objectInputStream.close();
|
||||
byteArrayInputStream.close();
|
||||
return object;
|
||||
// ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(str.getBytes("UTF-8"));
|
||||
// ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
|
||||
// HaoGameParamBean object = (HaoGameParamBean) objectInputStream.readObject();
|
||||
// objectInputStream.close();
|
||||
// byteArrayInputStream.close();
|
||||
HaoGameParamBean haoGameParamBean = gson.fromJson(str, HaoGameParamBean.class);
|
||||
return haoGameParamBean;
|
||||
}
|
||||
|
||||
public SortedMap<String, String> getParameterMapYX(HttpServletRequest request) {
|
||||
|
|
Loading…
Reference in New Issue