com.fasterxml.jackson.databind.node.TextNode.binaryValue()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(155)

本文整理了Java中com.fasterxml.jackson.databind.node.TextNode.binaryValue()方法的一些代码示例,展示了TextNode.binaryValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextNode.binaryValue()方法的具体详情如下:
包路径:com.fasterxml.jackson.databind.node.TextNode
类名称:TextNode
方法名:binaryValue

TextNode.binaryValue介绍

暂无

代码示例

代码示例来源:origin: gchq/Gaffer

@Override
public RoaringBitmap deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException {
  final TreeNode treeNode = jsonParser.getCodec().readTree(jsonParser);
  final TreeNode bitmapObject = treeNode.get(RoaringBitmapConstants.BITMAP_WRAPPER_OBJECT_NAME);
  if (null != bitmapObject) {
    final TextNode jsonNodes = (TextNode) bitmapObject.get(RoaringBitmapConstants.BITMAP_VALUE_FIELD_NAME);
    return (RoaringBitmap) bitmapSerialiser.deserialise(jsonNodes.binaryValue());
  } else {
    throw new IllegalArgumentException("Received null bitmap treenode");
  }
}

代码示例来源:origin: gchq/Gaffer

@Override
  public HyperLogLogPlus deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {

    final TreeNode treeNode = jsonParser.getCodec().readTree(jsonParser);

    final TreeNode coreHyperLogLogPlusObject = treeNode.get("hyperLogLogPlus");
    if (null != coreHyperLogLogPlusObject) {
      final TextNode jsonNodes = (TextNode) coreHyperLogLogPlusObject.get(HyperLogLogPlusJsonConstants.HYPER_LOG_LOG_PLUS_SKETCH_BYTES_FIELD);

      final byte[] nodeAsString = jsonNodes.binaryValue();
      final HyperLogLogPlus hyperLogLogPlus = HyperLogLogPlus.Builder.build(nodeAsString);

      return hyperLogLogPlus;
    } else {
      throw new IllegalArgumentException("Receieved null or empty HyperLogLogPlus sketch");
    }
  }
}

代码示例来源:origin: uk.gov.gchq.gaffer/bitmap-library

@Override
public RoaringBitmap deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException {
  final TreeNode treeNode = jsonParser.getCodec().readTree(jsonParser);
  final TreeNode bitmapObject = treeNode.get(RoaringBitmapConstants.BITMAP_WRAPPER_OBJECT_NAME);
  if (null != bitmapObject) {
    final TextNode jsonNodes = (TextNode) bitmapObject.get(RoaringBitmapConstants.BITMAP_VALUE_FIELD_NAME);
    return (RoaringBitmap) bitmapSerialiser.deserialise(jsonNodes.binaryValue());
  } else {
    throw new IllegalArgumentException("Received null bitmap treenode");
  }
}

代码示例来源:origin: uk.gov.gchq.gaffer/sketches-library

@Override
  public HyperLogLogPlus deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {

    final TreeNode treeNode = jsonParser.getCodec().readTree(jsonParser);

    final TreeNode coreHyperLogLogPlusObject = treeNode.get("hyperLogLogPlus");
    if (null != coreHyperLogLogPlusObject) {
      final TextNode jsonNodes = (TextNode) coreHyperLogLogPlusObject.get(HyperLogLogPlusJsonConstants.HYPER_LOG_LOG_PLUS_SKETCH_BYTES_FIELD);

      final byte[] nodeAsString = jsonNodes.binaryValue();
      final HyperLogLogPlus hyperLogLogPlus = HyperLogLogPlus.Builder.build(nodeAsString);

      return hyperLogLogPlus;
    } else {
      throw new IllegalArgumentException("Receieved null or empty HyperLogLogPlus sketch");
    }
  }
}

代码示例来源:origin: com.ning.billing/killbill-meter

@Test(groups = "fast")
public void testTimelineChunkCompactMapping() throws Exception {
  final String chunkToString = mapper.writerWithView(Compact.class).writeValueAsString(chunk);
  final Map chunkFromString = mapper.readValue(chunkToString, Map.class);
  Assert.assertEquals(chunkFromString.keySet().size(), 10);
  Assert.assertEquals(chunkFromString.get("sourceId"), HOST_ID);
  Assert.assertEquals(chunkFromString.get("metricId"), SAMPLE_KIND_ID);
  final Map<String, String> timeBytesAndSampleBytes = (Map<String, String>) chunkFromString.get("timeBytesAndSampleBytes");
  Assert.assertEquals(new TextNode(timeBytesAndSampleBytes.get("timeBytes")).binaryValue(), timeBytes);
  Assert.assertEquals(new TextNode(timeBytesAndSampleBytes.get("sampleBytes")).binaryValue(), samples);
  Assert.assertEquals(chunkFromString.get("sampleCount"), SAMPLE_COUNT);
  Assert.assertEquals(chunkFromString.get("aggregationLevel"), 0);
  Assert.assertEquals(chunkFromString.get("notValid"), false);
  Assert.assertEquals(chunkFromString.get("dontAggregate"), false);
  Assert.assertEquals(chunkFromString.get("chunkId"), (int) CHUNK_ID);
}

相关文章