Search in sources :

Example 1 with JsonValue

use of com.fasterxml.jackson.annotation.JsonValue in project druid by druid-io.

the class HyperLogLogCollector method toByteArray.

@JsonValue
public byte[] toByteArray() {
    final ByteBuffer buffer = toByteBuffer();
    byte[] theBytes = new byte[buffer.remaining()];
    buffer.get(theBytes);
    return theBytes;
}
Also used : ByteBuffer(java.nio.ByteBuffer) JsonValue(com.fasterxml.jackson.annotation.JsonValue)

Example 2 with JsonValue

use of com.fasterxml.jackson.annotation.JsonValue in project druid by druid-io.

the class Histogram method toBytes.

@JsonValue
public byte[] toBytes() {
    ByteBuffer buf = ByteBuffer.allocate(Ints.BYTES + Floats.BYTES * breaks.length + Longs.BYTES * bins.length + Floats.BYTES * 2);
    buf.putInt(breaks.length);
    for (float b : breaks) {
        buf.putFloat(b);
    }
    for (long c : bins) {
        buf.putLong(c);
    }
    buf.putFloat(min);
    buf.putFloat(max);
    return buf.array();
}
Also used : ByteBuffer(java.nio.ByteBuffer) JsonValue(com.fasterxml.jackson.annotation.JsonValue)

Example 3 with JsonValue

use of com.fasterxml.jackson.annotation.JsonValue in project druid by druid-io.

the class HyperLogLogCollector method toByteArray.

@JsonValue
public byte[] toByteArray() {
    final ByteBuffer buffer = toByteBuffer();
    byte[] theBytes = new byte[buffer.remaining()];
    buffer.get(theBytes);
    return theBytes;
}
Also used : ByteBuffer(java.nio.ByteBuffer) JsonValue(com.fasterxml.jackson.annotation.JsonValue)

Example 4 with JsonValue

use of com.fasterxml.jackson.annotation.JsonValue in project druid by druid-io.

the class ApproximateHistogram method toBytes.

/**
   * Returns a byte-array representation of this ApproximateHistogram object
   *
   * @return byte array representation
   */
@JsonValue
public byte[] toBytes() {
    ByteBuffer buf = ByteBuffer.allocate(getMinStorageSize());
    toBytes(buf);
    return buf.array();
}
Also used : ByteBuffer(java.nio.ByteBuffer) JsonValue(com.fasterxml.jackson.annotation.JsonValue)

Example 5 with JsonValue

use of com.fasterxml.jackson.annotation.JsonValue in project druid by druid-io.

the class VarianceAggregatorCollector method toByteArray.

@JsonValue
public byte[] toByteArray() {
    final ByteBuffer buffer = toByteBuffer();
    buffer.flip();
    byte[] theBytes = new byte[buffer.remaining()];
    buffer.get(theBytes);
    return theBytes;
}
Also used : ByteBuffer(java.nio.ByteBuffer) JsonValue(com.fasterxml.jackson.annotation.JsonValue)

Aggregations

JsonValue (com.fasterxml.jackson.annotation.JsonValue)13 ByteBuffer (java.nio.ByteBuffer)8 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 ByteArrayDataOutput (com.google.common.io.ByteArrayDataOutput)1 Integer.toHexString (java.lang.Integer.toHexString)1 Map (java.util.Map)1 Nonnull (javax.annotation.Nonnull)1 ConfigSource (org.embulk.config.ConfigSource)1 ConfigurationField (org.graylog2.plugin.configuration.fields.ConfigurationField)1