本文整理汇总了Java中com.fasterxml.jackson.core.JsonGenerator.writeArray方法的典型用法代码示例。如果您正苦于以下问题:Java JsonGenerator.writeArray方法的具体用法?Java JsonGenerator.writeArray怎么用?Java JsonGenerator.writeArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.core.JsonGenerator
的用法示例。
在下文中一共展示了JsonGenerator.writeArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeJson
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
public void writeJson(JsonGenerator generator) {
Objects.requireNonNull(generator);
try {
generator.writeStartObject();
generator.writeNumberField("offset", offset);
generator.writeNumberField("uncompressedLength", uncompressedLength);
generator.writeFieldName("stepValues");
writeStepValuesJson(generator);
generator.writeFieldName("stepLengths");
generator.writeArray(stepLengths, 0, stepLengths.length);
generator.writeEndObject();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例2: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(Index index, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
// jsonGenerator.writeStartObject();
jsonGenerator.writeObjectFieldStart("index");
jsonGenerator.writeNumberField("number", index.getIndex());
jsonGenerator.writeArrayFieldStart("numbers");
int[] numbers = index.getNumbers().stream().mapToInt(i -> i).toArray();
jsonGenerator.writeArray(numbers, 0, numbers.length);
jsonGenerator.writeEndArray();
jsonGenerator.writeEndObject();
// jsonGenerator.writeEndObject();
}
示例3: writeStepValuesJson
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
protected void writeStepValuesJson(JsonGenerator generator) throws IOException {
generator.writeArray(stepValues, 0, stepValues.length);
}
示例4: writeValuesJson
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
protected void writeValuesJson(JsonGenerator generator) throws IOException {
generator.writeArray(values, 0, values.length);
}
示例5: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(Vector value, JsonGenerator gen, SerializerProvider provider) throws IOException {
double[] arr = value.toArray();
gen.writeArray(arr, 0, arr.length);
}
示例6: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(IData value, JsonGenerator gen, SerializerProvider provider) throws IOException {
double[] dataValues = new double[value.getLength()];
value.assignTo(dataValues);
gen.writeArray(dataValues, 0, dataValues.length);
}