@Deprecated
protected String _readAll(Reader r, IOContext ctxt) throws IOException
{
// Let's use Jackson's efficient aggregators... better than JDK defaults
TextBuffer tb = ctxt.constructTextBuffer();
@Test
public void testSimpleLowStringLimit() throws IOException {
Bean original = new Bean("parent_field", new ChildBean("child_field"));
IonFactory ionFactory = new IonFactoryBuilder(false)
.streamReadConstraints(StreamReadConstraints.builder().maxStringLength(1).build())
.build();
IonObjectMapper mapper = new IonObjectMapper(ionFactory);
mapper.registerModule(new IonAnnotationModule());
String serialized = mapper.writeValueAsString(original);
//the next call should fail because the streamReadConstraints have such a small maxStringLength
Bean deserialized = mapper.readValue(serialized, Bean.class);
assertEquals(original.field, deserialized.field);
assertEquals(original.child.someField, deserialized.child.someField);
}
In IonFactory, there is
getText()and theory that can be changed to validate the string lengths.