This commit is contained in:
Looly
2022-06-20 12:34:40 +08:00
parent bd74cdb078
commit 1a0d7b51a7
34 changed files with 430 additions and 397 deletions

View File

@@ -225,7 +225,7 @@ public class JSONUtil {
* @throws IORuntimeException IO异常
*/
public static JSON readJSON(final File file, final Charset charset) throws IORuntimeException {
return parse(FileReader.create(file, charset).readString());
return parse(FileReader.of(file, charset).readString());
}
/**
@@ -237,7 +237,7 @@ public class JSONUtil {
* @throws IORuntimeException IO异常
*/
public static JSONObject readJSONObject(final File file, final Charset charset) throws IORuntimeException {
return parseObj(FileReader.create(file, charset).readString());
return parseObj(FileReader.of(file, charset).readString());
}
/**
@@ -249,7 +249,7 @@ public class JSONUtil {
* @throws IORuntimeException IO异常
*/
public static JSONArray readJSONArray(final File file, final Charset charset) throws IORuntimeException {
return parseArray(FileReader.create(file, charset).readString());
return parseArray(FileReader.of(file, charset).readString());
}
// -------------------------------------------------------------------- Read end

View File

@@ -1,6 +1,6 @@
package cn.hutool.json;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.date.TimeUtil;
import lombok.Data;
import org.junit.Assert;
import org.junit.Test;
@@ -20,12 +20,12 @@ public class Issue644Test {
final JSONObject jsonObject = JSONUtil.parseObj(beanWithDate);
BeanWithDate beanWithDate2 = JSONUtil.toBean(jsonObject, BeanWithDate.class);
Assert.assertEquals(LocalDateTimeUtil.formatNormal(beanWithDate.getDate()),
LocalDateTimeUtil.formatNormal(beanWithDate2.getDate()));
Assert.assertEquals(TimeUtil.formatNormal(beanWithDate.getDate()),
TimeUtil.formatNormal(beanWithDate2.getDate()));
beanWithDate2 = JSONUtil.toBean(jsonObject.toString(), BeanWithDate.class);
Assert.assertEquals(LocalDateTimeUtil.formatNormal(beanWithDate.getDate()),
LocalDateTimeUtil.formatNormal(beanWithDate2.getDate()));
Assert.assertEquals(TimeUtil.formatNormal(beanWithDate.getDate()),
TimeUtil.formatNormal(beanWithDate2.getDate()));
}
@Data