本文整理匯總了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);
}