Skip to content

Commit

Permalink
Flush writer on close
Browse files Browse the repository at this point in the history
  • Loading branch information
sksamuel committed Apr 28, 2024
1 parent 537affe commit 06aeb11
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class BinaryWriterFactory(
fun write(record: GenericRecord, codec: Codec? = null): ByteArray {
val writer = BinaryWriter(datumWriter, ByteArrayOutputStream(), factory)
writer.write(record)
writer.close()
return if (codec == null) writer.bytes() else {
val compressed = codec.compress(ByteBuffer.wrap(writer.bytes()))
val b = ByteArray(compressed.remaining())
Expand Down

0 comments on commit 06aeb11

Please sign in to comment.