From 8789d7f40c7e4d35055b5faa725e5bf59bfd5cee Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sun, 3 Jan 2021 23:22:27 +0100 Subject: [PATCH] BinarySerializer: implement Closeable, Flushable --- src.java/crosby/binary/BinarySerializer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src.java/crosby/binary/BinarySerializer.java b/src.java/crosby/binary/BinarySerializer.java index 153ea7f..683c2b1 100644 --- a/src.java/crosby/binary/BinarySerializer.java +++ b/src.java/crosby/binary/BinarySerializer.java @@ -17,6 +17,8 @@ package crosby.binary; +import java.io.Closeable; +import java.io.Flushable; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -35,7 +37,7 @@ import crosby.binary.file.FileBlock; * ordered to process their data at the appropriate time. * */ -public class BinarySerializer { +public class BinarySerializer implements Closeable, Flushable { /** * Interface used to write a group of primitives. One of these for each @@ -92,11 +94,13 @@ public class BinarySerializer { return stringtable; } + @Override public void flush() throws IOException { processBatch(); output.flush(); } + @Override public void close() throws IOException { flush(); output.close();