当前位置: 首页>>代码示例>>Java>>正文


Java JsonGenerator.writeBinary方法代码示例

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


在下文中一共展示了JsonGenerator.writeBinary方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(Face value, JsonGenerator jgen, SerializerProvider provider)
		throws IOException {
	jgen.writeStartObject();
	jgen.writeFieldId(1);
	jgen.writeObject(value.sai);
	jgen.writeFieldId(5);
	jgen.writeNumber(value.getTs().getTime()/1000);
	jgen.writeFieldId(6);
	jgen.writeNumber(value.getLifetime());
	jgen.writeFieldId(12);
	jgen.writeBinary(value.getNonce());
	jgen.writeFieldId(7);
	jgen.writeNumber(value.macMethod.encoding);
	jgen.writeEndObject();
}
 
开发者ID:beduino-project,项目名称:dcaf-java,代码行数:17,代码来源:Face.java

示例2: printFieldValue

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
private void printFieldValue(FieldDescriptor field, Object value, JsonGenerator generator) throws IOException {
	// TODO: look at using field.getType().getJavaType(), to simplify this..
	switch (field.getType()) {
        case INT32:
        case SINT32:
        case SFIXED32:
        	generator.writeNumber((Integer)value);
        	break;

        case INT64:
        case SINT64:
        case SFIXED64:
        	generator.writeNumber((Long)value);
        	break;

        case FLOAT:
        	generator.writeNumber((Float)value);
        	break;

        case DOUBLE:
        	generator.writeNumber((Double)value);
        	break;

        case BOOL:
            // Good old toString() does what we want for these types.
            generator.writeBoolean((Boolean)value);
            break;

        case UINT32:
        case FIXED32:
            generator.writeNumber(Integer.toUnsignedLong((Integer)value));
            break;

        case UINT64:
        case FIXED64:
            generator.writeNumber(unsignedLong((Long) value));
            break;

        case STRING:
        	generator.writeString((String) value);
            break;

        case BYTES: {
        	// Here we break with JsonFormat - since there is an issue with non-utf8 bytes..
        	generator.writeBinary(((ByteString)value).toByteArray());
            break;
        }

        case ENUM: {
        	generator.writeString(((EnumValueDescriptor) value).getName());
            break;
        }

        case MESSAGE:
        case GROUP:
        	generator.writeStartObject();
            printMessage((Message) value, generator);
            generator.writeEndObject();
            break;
    }
}
 
开发者ID:jigsaw-projects,项目名称:jigsaw-payment,代码行数:62,代码来源:JsonJacksonFormat.java

示例3: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(DrillbitEndpoint value, JsonGenerator jgen, SerializerProvider provider) throws IOException,
    JsonGenerationException {
  jgen.writeBinary(value.toByteArray());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:DrillbitEndpointSerDe.java

示例4: printBytes

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
static void printBytes(ByteString value, JsonGenerator gen) throws IOException {
  gen.writeBinary(value.toByteArray());
}
 
开发者ID:curioswitch,项目名称:curiostack,代码行数:4,代码来源:SerializeSupport.java

示例5: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(CompleteType value, JsonGenerator gen, SerializerProvider serializers)
    throws IOException, JsonProcessingException {
  gen.writeBinary(value.serialize());
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:6,代码来源:CompleteType.java

示例6: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(ByteString value, JsonGenerator gen, SerializerProvider provider) throws IOException {
  gen.writeBinary(value.toByteArray());
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:PhysicalPlanReader.java

示例7: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(BatchSchema value, JsonGenerator gen, SerializerProvider serializers)
    throws IOException, JsonProcessingException {
  gen.writeBinary(value.serialize());
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:6,代码来源:BatchSchema.java

示例8: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(NodeEndpoint value, JsonGenerator jgen, SerializerProvider provider) throws IOException,
    JsonGenerationException {
  jgen.writeBinary(value.toByteArray());
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:6,代码来源:NodeEndpointSerDe.java


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