• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JsonWriteContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.fasterxml.jackson.core.json.JsonWriteContext的典型用法代码示例。如果您正苦于以下问题:Java JsonWriteContext类的具体用法?Java JsonWriteContext怎么用?Java JsonWriteContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JsonWriteContext类属于com.fasterxml.jackson.core.json包,在下文中一共展示了JsonWriteContext类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: serialize

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
@Override
public void serialize(String str, JsonGenerator gen, SerializerProvider provider) throws IOException {
  int status = ((JsonWriteContext) gen.getOutputContext()).writeValue();
  switch (status) {
    case JsonWriteContext.STATUS_OK_AFTER_COLON:
      gen.writeRaw(':');
      break;
    case JsonWriteContext.STATUS_OK_AFTER_COMMA:
      gen.writeRaw(',');
      break;
    case JsonWriteContext.STATUS_EXPECT_NAME:
      throw new JsonGenerationException("Can not write string value here");
  }
  gen.writeRaw('"');
  for (char c : str.toCharArray()) {
    if (c >= 0x80) writeUnicodeEscape(gen, c); // use generic escaping for all non US-ASCII characters
    else {
      // use escape table for first 128 characters
      int code = (c < ESCAPE_CODES.length ? ESCAPE_CODES[c] : 0);
      if (code == 0) gen.writeRaw(c); // no escaping
      else if (code == -1) writeUnicodeEscape(gen, c); // generic escaping
      else writeShortEscape(gen, (char) code); // short escaping (\n \t ...)
    }
  }
  gen.writeRaw('"');
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:27,代码来源:JsonCodec.java


示例2: GeneratorBase

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
protected GeneratorBase(ObjectWriteContext writeCtxt, int features) {
    super();
    _objectWriteContext = writeCtxt;
    _features = features;
    DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features)
            ? DupDetector.rootDetector(this) : null;
    _outputContext = JsonWriteContext.createRootContext(dups);
    _cfgNumbersAsStrings = Feature.WRITE_NUMBERS_AS_STRINGS.enabledIn(features);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:GeneratorBase.java


示例3: TokenBuffer

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
public TokenBuffer(ObjectCodec paramObjectCodec)
{
  this._objectCodec = paramObjectCodec;
  this._generatorFeatures = DEFAULT_PARSER_FEATURES;
  this._writeContext = JsonWriteContext.createRootContext();
  Segment localSegment = new Segment();
  this._last = localSegment;
  this._first = localSegment;
  this._appendOffset = 0;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:11,代码来源:TokenBuffer.java


示例4: writeEndArray

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
public final void writeEndArray()
{
  _append(JsonToken.END_ARRAY);
  JsonWriteContext localJsonWriteContext = this._writeContext.getParent();
  if (localJsonWriteContext != null)
    this._writeContext = localJsonWriteContext;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:8,代码来源:TokenBuffer.java


示例5: writeEndObject

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
public final void writeEndObject()
{
  _append(JsonToken.END_OBJECT);
  JsonWriteContext localJsonWriteContext = this._writeContext.getParent();
  if (localJsonWriteContext != null)
    this._writeContext = localJsonWriteContext;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:8,代码来源:TokenBuffer.java


示例6: GeneratorBase

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
public GeneratorBase(int paramInt, ObjectCodec paramObjectCodec)
{
  this._features = paramInt;
  this._writeContext = JsonWriteContext.createRootContext();
  this._objectCodec = paramObjectCodec;
  this._cfgNumbersAsStrings = isEnabled(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:8,代码来源:GeneratorBase.java


示例7: _verifyValueWrite

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
@Override
protected void _verifyValueWrite(String typeMsg) throws IOException, JsonGenerationException {
    int status = _writeContext.writeValue();
    if (status == JsonWriteContext.STATUS_EXPECT_NAME) {
        _reportError("Can not "+typeMsg+", expecting field name");
    }
}
 
开发者ID:komamitsu,项目名称:jackson-dataformat-msgpack,代码行数:8,代码来源:MessagePackGenerator.java


示例8: writeFieldName

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
@Override
public final void writeFieldName(String name)  throws IOException, JsonGenerationException
{
    if (_writeContext.writeFieldName(name) == JsonWriteContext.STATUS_EXPECT_VALUE) {
        _reportError("Can not write a field name, expecting a value");
    }
    _writeFieldName(name);
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:9,代码来源:SmileGenerator.java


示例9: writeStringField

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
@Override
public final void writeStringField(String fieldName, String value)
    throws IOException, JsonGenerationException
{
    if (_writeContext.writeFieldName(fieldName) == JsonWriteContext.STATUS_EXPECT_VALUE) {
        _reportError("Can not write a field name, expecting a value");
    }
    _writeFieldName(fieldName);
    writeString(value);
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:11,代码来源:SmileGenerator.java


示例10: _verifyValueWrite

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
@Override
protected final void _verifyValueWrite(String typeMsg)
    throws IOException, JsonGenerationException
{
    int status = _writeContext.writeValue();
    if (status == JsonWriteContext.STATUS_EXPECT_NAME) {
        _reportError("Can not "+typeMsg+", expecting field name");
    }
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:10,代码来源:SmileGenerator.java


示例11: GeneratorBase

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
protected GeneratorBase(int features, ObjectCodec codec)
{
    super();
    _features = features;
    DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features)
            ? DupDetector.rootDetector(this) : null;
    _writeContext = JsonWriteContext.createRootContext(dups);
    _objectCodec = codec;
    _cfgNumbersAsStrings = Feature.WRITE_NUMBERS_AS_STRINGS.enabledIn(features);
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:11,代码来源:GeneratorBase.java


示例12: TokenBuffer

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
/**
 * @param codec Object codec to use for stream-based object
 *   conversion through parser/generator interfaces. If null,
 *   such methods can not be used.
 */
public TokenBuffer(ObjectCodec codec)
{
    _objectCodec = codec;
    _generatorFeatures = DEFAULT_PARSER_FEATURES;
    _writeContext = JsonWriteContext.createRootContext();
    // at first we have just one segment
    _first = _last = new Segment();
    _appendOffset = 0;
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:15,代码来源:TokenBuffer.java


示例13: writeEndArray

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
@Override
public final void writeEndArray()
    throws IOException, JsonGenerationException
{
    _append(JsonToken.END_ARRAY);
    // Let's allow unbalanced tho... i.e. not run out of root level, ever
    JsonWriteContext c = _writeContext.getParent();
    if (c != null) {
        _writeContext = c;
    }
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:12,代码来源:TokenBuffer.java


示例14: writeEndObject

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
@Override
public final void writeEndObject()
    throws IOException, JsonGenerationException
{
    _append(JsonToken.END_OBJECT);
    // Let's allow unbalanced tho... i.e. not run out of root level, ever
    JsonWriteContext c = _writeContext.getParent();
    if (c != null) {
        _writeContext = c;
    }
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:12,代码来源:TokenBuffer.java


示例15: GeneratorBase

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
protected GeneratorBase(int features, ObjectCodec codec)
{
    super();
    _features = features;
    _writeContext = JsonWriteContext.createRootContext();
    _objectCodec = codec;
    _cfgNumbersAsStrings = isEnabled(Feature.WRITE_NUMBERS_AS_STRINGS);
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:9,代码来源:GeneratorBase.java


示例16: getOutputContext

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
public final JsonWriteContext getOutputContext()
{
  return this._writeContext;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:5,代码来源:TokenBuffer.java


示例17: getOutputContext

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
@Override
public final JsonWriteContext getOutputContext() { return _writeContext; }
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:3,代码来源:TokenBuffer.java


示例18: getOutputContext

import com.fasterxml.jackson.core.json.JsonWriteContext; //导入依赖的package包/类
/**
 * Note: co-variant return type.
 */
@Override
public final JsonWriteContext getOutputContext() { return _writeContext; }
 
开发者ID:BFergerson,项目名称:Beam,代码行数:6,代码来源:GeneratorBase.java



注:本文中的com.fasterxml.jackson.core.json.JsonWriteContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Container类代码示例发布时间:2022-05-22
下一篇:
Java GenJDKLevel类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap