Java 类com.fasterxml.jackson.core.json.JsonReadContext 实例源码

项目:GitHub    文件:NonBlockingJsonParserBase.java   
protected final JsonToken _closeArrayScope() throws IOException
{
    if (!_parsingContext.inArray()) {
        _reportMismatchedEndMarker(']', '}');
    }
    JsonReadContext ctxt = _parsingContext.getParent();
    _parsingContext = ctxt;
    int st;
    if (ctxt.inObject()) {
        st = MAJOR_OBJECT_FIELD_NEXT;
    } else if (ctxt.inArray()) {
        st = MAJOR_ARRAY_ELEMENT_NEXT;
    } else {
        st = MAJOR_ROOT;
    }
    _majorState = st;
    _majorStateAfterValue = st;
    return (_currToken = JsonToken.END_ARRAY);
}
项目:GitHub    文件:NonBlockingJsonParserBase.java   
protected final JsonToken _closeObjectScope() throws IOException
{
    if (!_parsingContext.inObject()) {
        _reportMismatchedEndMarker('}', ']');
    }
    JsonReadContext ctxt = _parsingContext.getParent();
    _parsingContext = ctxt;
    int st;
    if (ctxt.inObject()) {
        st = MAJOR_OBJECT_FIELD_NEXT;
    } else if (ctxt.inArray()) {
        st = MAJOR_ARRAY_ELEMENT_NEXT;
    } else {
        st = MAJOR_ROOT;
    }
    _majorState = st;
    _majorStateAfterValue = st;
    return (_currToken = JsonToken.END_OBJECT);
}
项目:Beam    文件:ParserBase.java   
@Override
public void overrideCurrentName(String name)
{
    // Simple, but need to look for START_OBJECT/ARRAY's "off-by-one" thing:
    JsonReadContext ctxt = _parsingContext;
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        ctxt = ctxt.getParent();
    }
    /* 24-Sep-2013, tatu: Unfortunate, but since we did not expose exceptions,
     *   need to wrap this here
     */
    try {
        ctxt.setCurrentName(name);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
}
项目:GitHub    文件:ParserBase.java   
protected ParserBase(ObjectReadContext readCtxt,
        IOContext ctxt, int features) {
    super(readCtxt, features);
    _ioContext = ctxt;
    _textBuffer = ctxt.constructTextBuffer();
    DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features)
            ? DupDetector.rootDetector(this) : null;
    _parsingContext = JsonReadContext.createRootContext(dups);
}
项目:GitHub    文件:ParserBase.java   
/**
 * Method that can be called to get the name associated with
 * the current event.
 */
@Override public String currentName() throws IOException {
    // [JACKSON-395]: start markers require information from parent
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        JsonReadContext parent = _parsingContext.getParent();
        if (parent != null) {
            return parent.currentName();
        }
    }
    return _parsingContext.currentName();
}
项目:GitHub    文件:ParserBase.java   
@Override public void overrideCurrentName(String name) {
    // Simple, but need to look for START_OBJECT/ARRAY's "off-by-one" thing:
    JsonReadContext ctxt = _parsingContext;
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        ctxt = ctxt.getParent();
    }
    // 24-Sep-2013, tatu: Unfortunate, but since we did not expose exceptions,
    //  need to wrap this here
    try {
        ctxt.setCurrentName(name);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
}
项目:QuizUpWinner    文件:TokenBuffer.java   
public Parser(TokenBuffer.Segment paramSegment, ObjectCodec paramObjectCodec)
{
  super();
  this._segment = paramSegment;
  this._segmentPtr = -1;
  this._codec = paramObjectCodec;
  this._parsingContext = JsonReadContext.createRootContext(-1, -1);
}
项目:QuizUpWinner    文件:TokenBuffer.java   
public final void overrideCurrentName(String paramString)
{
  JsonReadContext localJsonReadContext = this._parsingContext;
  if ((this._currToken == JsonToken.START_OBJECT) || (this._currToken == JsonToken.START_ARRAY))
    localJsonReadContext = localJsonReadContext.getParent();
  localJsonReadContext.setCurrentName(paramString);
}
项目:jackson-dataformat-msgpack    文件:MessagePackParser.java   
@Override public String getCurrentName() throws IOException {
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        JsonReadContext parent = parsingContext.getParent();
        return parent.getCurrentName();
    }
    return parsingContext.getCurrentName();
}
项目:Beam    文件:ParserBase.java   
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;
    JsonReadContext readCtxt = JsonReadContext.createRootContext(dups);
    _parsingContext = readCtxt;
}
项目:Beam    文件:ParserBase.java   
/**
 * Method that can be called to get the name associated with
 * the current event.
 */
@Override
public String getCurrentName()
    throws IOException, JsonParseException
{
    // [JACKSON-395]: start markers require information from parent
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        JsonReadContext parent = _parsingContext.getParent();
        return parent.getCurrentName();
    }
    return _parsingContext.getCurrentName();
}
项目:cmonkey    文件:KBaseJsonParser.java   
protected ParserBase(int features, BufferRecycler _bufferRecycler, Object sourceRef, boolean managedResource)
{
    super();
    _features = features;
    _ioContext = new IOContext(_bufferRecycler, sourceRef, managedResource);
    _textBuffer = new TextBuffer(_bufferRecycler);  //ctxt.constructTextBuffer();
    _parsingContext = JsonReadContext.createRootContext();
}
项目:cmonkey    文件:KBaseJsonParser.java   
/**
 * Method that can be called to get the name associated with
 * the current event.
 */
@Override
public String getCurrentName()
    throws IOException, JsonParseException
{
    // [JACKSON-395]: start markers require information from parent
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        JsonReadContext parent = _parsingContext.getParent();
        return parent.getCurrentName();
    }
    return _parsingContext.getCurrentName();
}
项目:cmonkey    文件:KBaseJsonParser.java   
@Override
public void overrideCurrentName(String name)
{
    // Simple, but need to look for START_OBJECT/ARRAY's "off-by-one" thing:
    JsonReadContext ctxt = _parsingContext;
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        ctxt = ctxt.getParent();
    }
    ctxt.setCurrentName(name);
}
项目:joyplus-tv    文件:TokenBuffer.java   
public Parser(Segment firstSeg, ObjectCodec codec)
{
    super(0);
    _segment = firstSeg;
    _segmentPtr = -1; // not yet read
    _codec = codec;
    _parsingContext = JsonReadContext.createRootContext(-1, -1);
}
项目:joyplus-tv    文件:TokenBuffer.java   
@Override
public JsonToken nextToken() throws IOException, JsonParseException
{
    // If we are closed, nothing more to do
    if (_closed || (_segment == null)) return null;

    // Ok, then: any more tokens?
    if (++_segmentPtr >= Segment.TOKENS_PER_SEGMENT) {
        _segmentPtr = 0;
        _segment = _segment.next();
        if (_segment == null) {
            return null;
        }
    }
    _currToken = _segment.type(_segmentPtr);
    // Field name? Need to update context
    if (_currToken == JsonToken.FIELD_NAME) {
        Object ob = _currentObject();
        String name = (ob instanceof String) ? ((String) ob) : ob.toString();
        _parsingContext.setCurrentName(name);
    } else if (_currToken == JsonToken.START_OBJECT) {
        _parsingContext = _parsingContext.createChildObjectContext(-1, -1);
    } else if (_currToken == JsonToken.START_ARRAY) {
        _parsingContext = _parsingContext.createChildArrayContext(-1, -1);
    } else if (_currToken == JsonToken.END_OBJECT
            || _currToken == JsonToken.END_ARRAY) {
        // Closing JSON Object/Array? Close matching context
        _parsingContext = _parsingContext.getParent();
        // but allow unbalanced cases too (more close markers)
        if (_parsingContext == null) {
            _parsingContext = JsonReadContext.createRootContext(-1, -1);
        }
    }
    return _currToken;
}
项目:joyplus-tv    文件:TokenBuffer.java   
@Override
public void overrideCurrentName(String name)
{
    // Simple, but need to look for START_OBJECT/ARRAY's "off-by-one" thing:
    JsonReadContext ctxt = _parsingContext;
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        ctxt = ctxt.getParent();
    }
    ctxt.setCurrentName(name);
}
项目:joyplus-tv    文件:ParserBase.java   
protected ParserBase(IOContext ctxt, int features)
{
    super();
    _features = features;
    _ioContext = ctxt;
    _textBuffer = ctxt.constructTextBuffer();
    _parsingContext = JsonReadContext.createRootContext();
}
项目:joyplus-tv    文件:ParserBase.java   
/**
 * Method that can be called to get the name associated with
 * the current event.
 */
@Override
public String getCurrentName()
    throws IOException, JsonParseException
{
    // [JACKSON-395]: start markers require information from parent
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        JsonReadContext parent = _parsingContext.getParent();
        return parent.getCurrentName();
    }
    return _parsingContext.getCurrentName();
}
项目:joyplus-tv    文件:ParserBase.java   
@Override
public void overrideCurrentName(String name)
{
    // Simple, but need to look for START_OBJECT/ARRAY's "off-by-one" thing:
    JsonReadContext ctxt = _parsingContext;
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        ctxt = ctxt.getParent();
    }
    ctxt.setCurrentName(name);
}
项目:GitHub    文件:ParserBase.java   
protected void _reportMismatchedEndMarker(int actCh, char expCh) throws JsonParseException {
    JsonReadContext ctxt = getParsingContext();
    _reportError(String.format(
            "Unexpected close marker '%s': expected '%c' (for %s starting at %s)",
            (char) actCh, expCh, ctxt.typeDesc(), ctxt.getStartLocation(_getSourceReference())));
}
项目:QuizUpWinner    文件:TokenBuffer.java   
public final JsonToken nextToken()
{
  if ((this._closed) || (this._segment == null))
    return null;
  int i = 1 + this._segmentPtr;
  this._segmentPtr = i;
  if (i >= 16)
  {
    this._segmentPtr = 0;
    this._segment = this._segment.next();
    if (this._segment == null)
      return null;
  }
  this._currToken = this._segment.type(this._segmentPtr);
  if (this._currToken == JsonToken.FIELD_NAME)
  {
    Object localObject = _currentObject();
    String str1;
    if ((localObject instanceof String))
      str1 = (String)localObject;
    else
      str1 = localObject.toString();
    String str2 = str1;
    this._parsingContext.setCurrentName(str2);
  }
  else if (this._currToken == JsonToken.START_OBJECT)
  {
    this._parsingContext = this._parsingContext.createChildObjectContext(-1, -1);
  }
  else if (this._currToken == JsonToken.START_ARRAY)
  {
    this._parsingContext = this._parsingContext.createChildArrayContext(-1, -1);
  }
  else if ((this._currToken == JsonToken.END_OBJECT) || (this._currToken == JsonToken.END_ARRAY))
  {
    this._parsingContext = this._parsingContext.getParent();
    if (this._parsingContext == null)
      this._parsingContext = JsonReadContext.createRootContext(-1, -1);
  }
  return this._currToken;
}
项目:Beam    文件:ParserBase.java   
@Override
public JsonReadContext getParsingContext()
{
    return _parsingContext;
}
项目:cmonkey    文件:KBaseJsonParser.java   
@Override
public JsonReadContext getParsingContext()
{
    return _parsingContext;
}
项目:joyplus-tv    文件:ParserBase.java   
@Override
public JsonReadContext getParsingContext()
{
    return _parsingContext;
}
项目:GitHub    文件:ParserBase.java   
@Override public JsonReadContext getParsingContext() { return _parsingContext; }