目前我们正在使用 Jackson 进行序列化。
问题是我不能在流中写入多个地图,我的代码是
ObjectMapper mapper = new ObjectMapper();
mapper.configure(com.fasterxml.jackson.core.JsonGenerator.Feature.FLUSH_PASSED_TO_STREAM, false);
mapper.writeValue(writer, myMap);
目前我们正在使用 Jackson 进行序列化。
问题是我不能在流中写入多个地图,我的代码是
ObjectMapper mapper = new ObjectMapper();
mapper.configure(com.fasterxml.jackson.core.JsonGenerator.Feature.FLUSH_PASSED_TO_STREAM, false);
mapper.writeValue(writer, myMap);
我相信,设置FLUSH_AFTER_WRITE_VALUE
为false
,是您正在寻找的。
https://github.com/FasterXML/jackson-databind/wiki/Serialization-features#output-life-cycle-features