protected ParserBase(IOContext ctxt, int features) { super(features); _ioContext = ctxt; _textBuffer = ctxt.constructTextBuffer(); DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features) ? DupDetector.rootDetector(this) : null; _parsingContext = JsonReadContext.createRootContext(dups); }
/** * Helper method used to encapsulate logic of including (or not) of * "source reference" when constructing {@link JsonLocation} instances. * * @since 2.9 */ protected Object _getSourceReference() { if (JsonParser.Feature.INCLUDE_SOURCE_IN_LOCATION.enabledIn(_features)) { return _ioContext.getSourceReference(); } return null; }
@Override public void close() throws IOException { if (shouldCloseReader) { reader.close(); } else if (Feature.AUTO_CLOSE_SOURCE.enabledIn(_features)) { reader.close(); } closed = true; }
@Override public void close() throws IOException { if (shouldCloseReader) { reader.close(); } else if (Feature.AUTO_CLOSE_SOURCE.enabledIn(_features)) { reader.close(); } closed = true; }
protected ParserBase(IOContext ctxt, int features) { super(features); _ioContext = ctxt; _textBuffer = ctxt.constructTextBuffer(); DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features) ? DupDetector.rootDetector(this) : null; _parsingContext = JsonReadContext.createRootContext(dups); }
protected ParserBase(IOContext ctxt, int features) { super(); _features = features; _ioContext = ctxt; _textBuffer = ctxt.constructTextBuffer(); DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features) ? DupDetector.rootDetector(this) : null; _parsingContext = JsonReadContext.createRootContext(dups); }
protected ParserBase(IOContext ctxt, int features) { super(); _features = features; _ioContext = ctxt; _textBuffer = ctxt.constructTextBuffer(); DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features) ? DupDetector.rootDetector(this) : null; _parsingContext = JsonReadContext.createRootContext(dups); }
public CsvParser(CsvIOContext ctxt, int stdFeatures, int csvFeatures, ObjectCodec codec, Reader reader) { super(stdFeatures); _objectCodec = codec; _textBuffer = ctxt.csvTextBuffer(); DupDetector dups = JsonParser.Feature.STRICT_DUPLICATE_DETECTION.enabledIn(stdFeatures) ? DupDetector.rootDetector(this) : null; _formatFeatures = csvFeatures; _parsingContext = JsonReadContext.createRootContext(dups); _reader = new CsvDecoder(this, ctxt, reader, _schema, _textBuffer, stdFeatures, csvFeatures); }
@Override public void close() throws IOException { if (shouldCloseReader) { reader.close(); } else if (Feature.AUTO_CLOSE_SOURCE.enabledIn(_features)) { reader.close(); } closed = true; }
@Override public void close() throws IOException { if (shouldCloseReader) { reader.close(); } else if (Feature.AUTO_CLOSE_SOURCE.enabledIn(_features)) { reader.close(); } closed = true; }
if (Feature.ALLOW_TRAILING_COMMA.enabledIn(_features)) { if (i == INT_RBRACKET || i == INT_RCURLY) { _closeScope(i);
if (Feature.ALLOW_TRAILING_COMMA.enabledIn(_features)) { if (i == INT_RBRACKET || i == INT_RCURLY) { _closeScope(i);
if (ch != INT_QUOTE) { if (ch == INT_RCURLY) { if (JsonParser.Feature.ALLOW_TRAILING_COMMA.enabledIn(_features)) { return _closeObjectScope();
if (JsonParser.Feature.ALLOW_YAML_COMMENTS.enabledIn(_features)) { return _finishHashComment(MINOR_FIELD_LEADING_WS);
private final JsonToken _finishHashComment(int fromMinorState) throws IOException { // Could by-pass this check by refactoring, but for now simplest way... if (!JsonParser.Feature.ALLOW_YAML_COMMENTS.enabledIn(_features)) { _reportUnexpectedChar('#', "maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_YAML_COMMENTS' not enabled for parser)"); } while (true) { if (_inputPtr >= _inputEnd) { _minorState = MINOR_COMMENT_YAML; _pending32 = fromMinorState; return (_currToken = JsonToken.NOT_AVAILABLE); } int ch = _inputBuffer[_inputPtr++] & 0xFF; if (ch < 0x020) { if (ch == INT_LF) { ++_currInputRow; _currInputRowStart = _inputPtr; break; } else if (ch == INT_CR) { ++_currInputRowAlt; _currInputRowStart = _inputPtr; break; } else if (ch != INT_TAB) { _throwInvalidSpace(ch); } } } return _startAfterComment(fromMinorState); }
private final JsonToken _startSlashComment(int fromMinorState) throws IOException { if (!JsonParser.Feature.ALLOW_COMMENTS.enabledIn(_features)) { _reportUnexpectedChar('/', "maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_COMMENTS' not enabled for parser)"); } // After that, need to verify if we have c/c++ comment if (_inputPtr >= _inputEnd) { _pending32 = fromMinorState; _minorState = MINOR_COMMENT_LEADING_SLASH; return (_currToken = JsonToken.NOT_AVAILABLE); } int ch = _inputBuffer[_inputPtr++]; if (ch == INT_ASTERISK) { // c-style return _finishCComment(fromMinorState, false); } if (ch == INT_SLASH) { // c++-style return _finishCppComment(fromMinorState); } _reportUnexpectedChar(ch & 0xFF, "was expecting either '*' or '/' for a comment"); return null; }
@Override public void close() throws IOException { if (shouldCloseReader) { reader.close(); } else if (Feature.AUTO_CLOSE_SOURCE.enabledIn(_features)) { reader.close(); } closed = true; }
/** * Method for checking whether specified {@link Feature} is enabled. */ public boolean isEnabled(Feature f) { return f.enabledIn(_features); }
protected ParserBase(IOContext ctxt, int features) { super(features); _ioContext = ctxt; _textBuffer = ctxt.constructTextBuffer(); DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features) ? DupDetector.rootDetector(this) : null; _parsingContext = JsonReadContext.createRootContext(dups); }
/** * Helper method used to encapsulate logic of including (or not) of * "source reference" when constructing {@link JsonLocation} instances. * * @since 2.9 */ protected Object _getSourceReference() { if (JsonParser.Feature.INCLUDE_SOURCE_IN_LOCATION.enabledIn(_features)) { return _ioContext.getSourceReference(); } return null; }