@Test public void testRecordHandlesArrayByteBuffer() { ByteBuffer expected = ByteBuffer.wrap(new byte[] { 1, 2, 3, 4 }); kinesisClientRecord = defaultRecord().data(expected).build(); JsonFriendlyRecord jsonFriendlyRecord = JsonFriendlyRecord.fromKinesisClientRecord(kinesisClientRecord); assertThat(jsonFriendlyRecord, equivalentTo(kinesisClientRecord)); }
public static JsonFriendlyRecord fromKinesisClientRecord(@NonNull final KinesisClientRecord record) { byte[] data; if (record.data() == null) { data = null; } else if (record.data().hasArray()) { data = record.data().array(); } else { data = new byte[record.data().limit()]; record.data().get(data); } Long approximateArrival = record.approximateArrivalTimestamp() == null ? null : record.approximateArrivalTimestamp().toEpochMilli(); return new JsonFriendlyRecord(data, record.partitionKey(), record.sequenceNumber(), approximateArrival, record.subSequenceNumber()); }
JsonFriendlyRecord { public static JsonFriendlyRecord fromKinesisClientRecord(@NonNull final KinesisClientRecord record) { byte[] data; if (record.data() == null) { data = null; } else if (record.data().hasArray()) { data = record.data().array(); } else { data = new byte[record.data().limit()]; record.data().get(data); } Long approximateArrival = record.approximateArrivalTimestamp() == null ? null : record.approximateArrivalTimestamp().toEpochMilli(); return new JsonFriendlyRecord(data, record.partitionKey(), record.sequenceNumber(), approximateArrival, record.subSequenceNumber()); } }
JsonFriendlyRecord { public static JsonFriendlyRecord fromKinesisClientRecord(@NonNull final KinesisClientRecord record) { byte[] data; if (record.data() == null) { data = null; } else if (record.data().hasArray()) { data = record.data().array(); } else { data = new byte[record.data().limit()]; record.data().get(data); } Long approximateArrival = record.approximateArrivalTimestamp() == null ? null : record.approximateArrivalTimestamp().toEpochMilli(); return new JsonFriendlyRecord(data, record.partitionKey(), record.sequenceNumber(), approximateArrival, record.subSequenceNumber()); }  }
JsonFriendlyRecord { public static JsonFriendlyRecord fromKinesisClientRecord(@NonNull final KinesisClientRecord record) { byte[] data; if (record.data() == null) { data = null; } else if (record.data().hasArray()) { data = record.data().array(); } else { data = new byte[record.data().limit()]; record.data().get(data); } Long approximateArrival = record.approximateArrivalTimestamp() == null ? null : record.approximateArrivalTimestamp().toEpochMilli(); return new JsonFriendlyRecord(data, record.partitionKey(), record.sequenceNumber(), approximateArrival, record.subSequenceNumber()); }  static JsonFriendlyRecord fromKinesisClientRecord(@NonNull final KinesisClientRecord record); @JsonProperty String getAction(); }
JsonFriendlyRecord { public static JsonFriendlyRecord fromKinesisClientRecord(@NonNull final KinesisClientRecord record) { byte[] data; if (record.data() == null) { data = null; } else if (record.data().hasArray()) { data = record.data().array(); } else { data = new byte[record.data().limit()]; record.data().get(data); } Long approximateArrival = record.approximateArrivalTimestamp() == null ? null : record.approximateArrivalTimestamp().toEpochMilli(); return new JsonFriendlyRecord(data, record.partitionKey(), record.sequenceNumber(), approximateArrival, record.subSequenceNumber()); }  static JsonFriendlyRecord fromKinesisClientRecord(@NonNull final KinesisClientRecord record); @JsonProperty String getAction(); static String ACTION; }