Class SequenceWriter
java.lang.Object
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.SequenceWriter
- All Implemented Interfaces:
Versioned
,Closeable
,Flushable
,AutoCloseable
Writer class similar to
ObjectWriter
, except that it can be used
for writing sequences of values, not just a single value.
The main use case is in writing very long sequences, or sequences where
values are incrementally produced; cases where it would be impractical
or at least inconvenient to construct a wrapper container around values
(or where no JSON array is desired around values).
Differences from ObjectWriter
include:
- Instances of
SequenceWriter
are stateful, and not thread-safe: if sharing, external synchronization must be used. - Explicit
close()
is needed after all values have been written (ObjectWriter
can auto-close after individual value writes)
- Since:
- 2.5
-
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
protected final boolean
protected boolean
protected final boolean
protected final SerializationConfig
protected PropertySerializerMap
If_rootSerializer
is not defined (no root type was used for constructingObjectWriter
), we will use simple scheme for keeping track of serializers needed.protected final JsonGenerator
protected boolean
State flag for keeping track of need to write matching END_ARRAY, if a START_ARRAY was written during initializationprotected final DefaultSerializerProvider
protected final JsonSerializer<Object>
protected final TypeSerializer
-
Constructor Summary
ConstructorDescriptionSequenceWriter
(DefaultSerializerProvider prov, JsonGenerator gen, boolean closeGenerator, ObjectWriter.Prefetch prefetch) -
Method Summary
Modifier and TypeMethodDescriptionprotected SequenceWriter
_writeCloseableValue
(Object value) protected SequenceWriter
_writeCloseableValue
(Object value, JavaType type) void
close()
void
flush()
init
(boolean wrapInArray) Internal method called byObjectWriter
: should not be called by code outsidejackson-databind
classes.version()
Method that will return version information stored in and read from jar that contains this class.Method for writing given value into output, as part of sequence to write.Method for writing given value into output, as part of sequence to write; further, full type (often generic, likeMap
is passed in case a newJsonSerializer
needs to be fetched to handle type If root type was specified forObjectWriter
, value must be of compatible type (same or subtype).<C extends Collection<?>>
SequenceWriterwriteAll
(C container)
-
Field Details
-
_provider
-
_config
-
_generator
-
_rootSerializer
-
_typeSerializer
-
_closeGenerator
protected final boolean _closeGenerator -
_cfgFlush
protected final boolean _cfgFlush -
_cfgCloseCloseable
protected final boolean _cfgCloseCloseable -
_dynamicSerializers
If_rootSerializer
is not defined (no root type was used for constructingObjectWriter
), we will use simple scheme for keeping track of serializers needed. Assumption is that -
_openArray
protected boolean _openArrayState flag for keeping track of need to write matching END_ARRAY, if a START_ARRAY was written during initialization -
_closed
protected boolean _closed
-
-
Constructor Details
-
SequenceWriter
public SequenceWriter(DefaultSerializerProvider prov, JsonGenerator gen, boolean closeGenerator, ObjectWriter.Prefetch prefetch) throws IOException - Throws:
IOException
-
-
Method Details
-
init
Internal method called byObjectWriter
: should not be called by code outsidejackson-databind
classes.- Throws:
IOException
-
version
Method that will return version information stored in and read from jar that contains this class. -
write
Method for writing given value into output, as part of sequence to write. If root type was specified forObjectWriter
, value must be of compatible type (same or subtype).- Throws:
IOException
-
write
Method for writing given value into output, as part of sequence to write; further, full type (often generic, likeMap
is passed in case a newJsonSerializer
needs to be fetched to handle type If root type was specified forObjectWriter
, value must be of compatible type (same or subtype).- Throws:
IOException
-
writeAll
- Throws:
IOException
-
writeAll
- Throws:
IOException
-
writeAll
- Throws:
IOException
- Since:
- 2.7
-
flush
- Specified by:
flush
in interfaceFlushable
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
_writeCloseableValue
- Throws:
IOException
-
_writeCloseableValue
- Throws:
IOException
-