private static <T> GenericIndexed<T> read(ByteBuffer buf, ComplexMetricSerde serde) { return GenericIndexed.read(buf, serde.getObjectStrategy()); }
/** * This method provides the ability for a ComplexMetricSerde to control its own serialization. * For large column (i.e columns greater than {@link Integer#MAX_VALUE}) use * {@link LargeColumnSupportedComplexColumnSerializer} * * @return an instance of GenericColumnSerializer used for serialization. */ public GenericColumnSerializer getSerializer(SegmentWriteOutMedium segmentWriteOutMedium, String column) { return ComplexColumnSerializer.create(segmentWriteOutMedium, column, this.getObjectStrategy()); } }
/** * Converts byte[] to intermediate representation of the aggregate. * * @param data array * @param start offset in the byte array where to start reading * @param numBytes number of bytes to read in given array * * @return intermediate representation of the aggregate */ public Object fromBytes(byte[] data, int start, int numBytes) { ByteBuffer bb = ByteBuffer.wrap(data); if (start > 0) { bb.position(start); } return getObjectStrategy().fromByteBuffer(bb, numBytes); }
/** * Converts intermediate representation of aggregate to byte[]. * * @param val intermediate representation of aggregate * * @return serialized intermediate representation of aggregate in byte[] */ public byte[] toBytes(@Nullable Object val) { if (val != null) { byte[] bytes = getObjectStrategy().toBytes(val); return bytes != null ? bytes : ByteArrays.EMPTY_ARRAY; } else { return ByteArrays.EMPTY_ARRAY; } }
/** * This method provides the ability for a ComplexMetricSerde to control its own serialization. * For large column (i.e columns greater than {@link Integer#MAX_VALUE}) use * {@link LargeColumnSupportedComplexColumnSerializer} * * @return an instance of GenericColumnSerializer used for serialization. */ public GenericColumnSerializer getSerializer(SegmentWriteOutMedium segmentWriteOutMedium, String column) { return ComplexColumnSerializer.create(segmentWriteOutMedium, column, this.getObjectStrategy()); } }
private static <T> GenericIndexed<T> read(ByteBuffer buf, ComplexMetricSerde serde) { return GenericIndexed.read(buf, serde.getObjectStrategy()); }
/** * Converts intermediate representation of aggregate to byte[]. * * @param val intermediate representation of aggregate * * @return serialized intermediate representation of aggregate in byte[] */ public byte[] toBytes(@Nullable Object val) { if (val != null) { byte[] bytes = getObjectStrategy().toBytes(val); return bytes != null ? bytes : ByteArrays.EMPTY_ARRAY; } else { return ByteArrays.EMPTY_ARRAY; } }
/** * Converts byte[] to intermediate representation of the aggregate. * * @param data array * @param start offset in the byte array where to start reading * @param numBytes number of bytes to read in given array * * @return intermediate representation of the aggregate */ public Object fromBytes(byte[] data, int start, int numBytes) { ByteBuffer bb = ByteBuffer.wrap(data); if (start > 0) { bb.position(start); } return getObjectStrategy().fromByteBuffer(bb, numBytes); }