+public abstract class JSONNormalizedNodeStreamWriter implements NormalizedNodeStreamWriter {
+ private static final class Exclusive extends JSONNormalizedNodeStreamWriter {
+ Exclusive(final JSONCodecFactory codecFactory, final SchemaPath path, final JsonWriter writer,
+ final JSONStreamWriterRootContext rootContext) {
+ super(codecFactory, path, writer, rootContext);
+ }
+
+ @Override
+ public void close() throws IOException {
+ flush();
+ closeWriter();
+ }
+ }
+
+ private static final class Nested extends JSONNormalizedNodeStreamWriter {
+ Nested(final JSONCodecFactory codecFactory, final SchemaPath path, final JsonWriter writer,
+ final JSONStreamWriterRootContext rootContext) {
+ super(codecFactory, path, writer, rootContext);
+ }
+
+ @Override
+ public void close() throws IOException {
+ flush();
+ // The caller "owns" the writer, let them close it
+ }
+ }
+