本文整理汇总了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();
}
示例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;
}
}
示例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());
}
示例4: printBytes
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
static void printBytes(ByteString value, JsonGenerator gen) throws IOException {
gen.writeBinary(value.toByteArray());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}