> On Mar 28, 2023, at 20:51, Tatu Saloranta <t...@fasterxml.com> wrote: > > But as I said, decoding from bytes to chars itself does not require > allocations, yet. > So `parser.getTextCharacters()` for example typically avoids > allocations (except for buffer boundaries, > long strings etc).
So would the following work as intended? public class JsonInterningDeserializer extends JsonDeserializer<String> { private final CharsToNameCanonicalizer can = CharsToNameCanonicalizer.createRoot(); @Override public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JacksonException { char[] buf = p.getTextCharacters(); int start = p.getTextOffset(); int len = p.getTextLength(); int hash = can.calcHash(buf, start, len); return can.findSymbol(buf, start, len, hash); } } Thanks, Viktor -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to jackson-user+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/FA461A75-D6C8-4C18-AE4F-8BDEF994AF1D%40gmail.com.