@Override public JsonParser createParser(ObjectReadContext readCtxt, char[] content, int offset, int len) throws IOException { if (_inputDecorator != null) { // easier to just wrap in a Reader than extend InputDecorator return createParser(readCtxt, new CharArrayReader(content, offset, len)); } return _createParser(readCtxt, _createContext(content, true), content, offset, len, // important: buffer is NOT recyclable, as it's from caller false); }
@Override public JsonParser createParser(ObjectReadContext readCtxt, String content) throws IOException { final int strLen = content.length(); // Actually, let's use this for medium-sized content, up to 64kB chunk (32kb char) if ((_inputDecorator != null) || (strLen > 0x8000) || !canUseCharArrays()) { // easier to just wrap in a Reader than extend InputDecorator; or, if content // is too long for us to copy it over return createParser(readCtxt, new StringReader(content)); } IOContext ioCtxt = _createContext(content, true); char[] buf = ioCtxt.allocTokenBuffer(strLen); content.getChars(0, strLen, buf, 0); return _createParser(readCtxt, ioCtxt, buf, 0, strLen, true); }