Created
March 4, 2024 20:43
-
-
Save charles-tan/fa63b4e4b66bbe885d76318d9a4b1740 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public byte[] serialize(KafkaPartitionSplit split) throws IOException { | |
try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
DataOutputStream out = new DataOutputStream(baos)) { | |
out.writeUTF(split.getTopic()); | |
out.writeInt(split.getPartition()); | |
out.writeLong(split.getStartingOffset()); | |
out.writeLong(split.getStoppingOffset().orElse(KafkaPartitionSplit.NO_STOPPING_OFFSET)); | |
out.flush(); | |
return baos.toByteArray(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment