| Modifier and Type | Field and Description |
|---|---|
| protected ByteAccumulator | _buffered
Object used in cases where we need to buffer content to calculate length-prefix. |
| protected boolean | _complete
Flag that is set when the whole content is complete, can be output. |
| protected byte[] | _currBuffer
Currently active output buffer, place where appends occur. |
| protected ProtobufField | _currField
Field to be output next; set when |
| protected ProtobufMessage | _currMessage
Type of protobuf message that is currently being output: usually matches write context, but for arrays may indicate "parent" of array. |
| protected int | |
| protected int | |
| protected boolean | |
| protected byte[] | _origCurrBuffer
The first allocated (or recycled) buffer instance; needed to avoid issue [dataformat-protobuf#14]. |
| protected final OutputStream | _output
Ultimate destination |
| protected ProtobufWriteContext | _rootContext
Reference to the root context since that is needed for serialization |
| protected final ProtobufSchema | |
| protected ProtobufWriteContext | _streamWriteContext
Current context, in form we can use it. |
| protected boolean | _writeTag
Flag that indicates whether values should be written with tag or not; false for packed arrays, true for others. |
| protected static final ProtobufField | UNKNOWN_FIELD
This instance is used as a placeholder for cases where we do not know actual field and want to simply skip over any values that caller tries to write for it. |
| protected static final ProtobufMessage | UNKNOWN_MESSAGE
This is used as a placeholder for case where we don't have an actual message to use, but know (from context) that one is expected. |
| private static final Charset |
| Access | Constructor and Description |
|---|---|
| public | ProtobufGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, int streamWriteFeatures, ProtobufSchema schema, OutputStream output)
|
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected final void | |
| protected final void | |
| private final void | _finishBuffering()
Helper method called when the current buffering scope is closed; when packed array is completed (`writeEndArray()`) or record is completed (`writeEndObject()`). |
| protected void | _releaseBuffers()
Implements abstract tools. Method called to release any buffers generator may be holding, once generator is being closed. |
| protected void | |
| private void | |
| protected void | |
| private final void | _startBuffering(int typedTag)
Method called when buffering an entry that should be prefixed with a type tag. |
| private final void | |
| private void | |
| private void | |
| protected final void | |
| protected void | _verifyValueWrite(String typeMsg)
Implements abstract tools. Method called before trying to write a value (scalar or structured), to verify that this is legal in current output state, as well as to output separators if and as necessary. |
| protected void | |
| protected void | |
| protected void | |
| private final void | |
| private final void | |
| private final void | |
| private final void | |
| protected void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private final int | |
| private final void | |
| private final int | |
| private final void | |
| private final void | |
| private final int | |
| private final void | |
| public final void | assignCurrentValue(Object v)
Implements abstract tools. Helper method, usually equivalent to:
|
| public final Object | currentValue()
Implements abstract tools. Helper method, usually equivalent to:
Note that "current value" is NOT populated (or used) by Streaming generator; it is only used by higher-level data-binding functionality. |
| public final void | flush()
Implements abstract tools. Implements java. Method called to flush any buffered content to the underlying target (output stream, writer), and to flush the target itself as well. |
| public PrettyPrinter | getPrettyPrinter()
Overrides tools. Accessor for object that handles pretty-printing (usually additional white space to make results more human-readable) during output. |
| public ProtobufSchema | getSchema()
Overrides tools. Method for accessing Schema that this generator uses, if any. |
| public JacksonFeatureSet | streamWriteCapabilities()
Implements abstract tools. Accessor for getting metadata on capabilities of this generator, based on underlying data format being read (directly or indirectly). |
| public final TokenStreamContext | streamWriteContext()
Implements abstract tools. Accessor for context object that provides information about low-level logical position withing output token stream. |
| public int | streamWriteOutputBuffered()
Implements abstract tools. Calculating actual amount of buffering is somewhat complicated, and can not necessarily give 100% accurate answer due to presence of VInt encoding for length indicators. |
| public Object | streamWriteOutputTarget()
Implements abstract tools. Method that can be used to get access to object that is used
as target for generated output; this is usually either
|
| public Version | version()
Implements abstract tools. Implements tools. Accessor for finding out version of the bundle that provided this generator instance. |
| public JsonGenerator | writeArray(int[] array, int offset, int length)
Overrides tools. Value write method that can be called to write a single
array (sequence of |
| public JsonGenerator | writeArray(long[] array, int offset, int length)
Overrides tools. Value write method that can be called to write a single
array (sequence of |
| public JsonGenerator | writeArray(double[] array, int offset, int length)
Overrides tools. Value write method that can be called to write a single
array (sequence of |
| public JsonGenerator | writeBinary(Base64Variant b64variant, byte[] data, int offset, int len)
Implements abstract tools. Method that will output given chunk of binary data as base64 encoded, as a complete String value (surrounded by double quotes). |
| public JsonGenerator | writeBoolean(boolean state)
Implements abstract tools. Method for outputting literal JSON boolean value (one of Strings 'true' and 'false'). |
| public JsonGenerator | writeEndArray()
Implements abstract tools. Method for writing closing marker of a JSON Array value (character ']'; plus possible white space decoration if pretty-printing is enabled). |
| public JsonGenerator | writeEndObject()
Implements abstract tools. Method for writing closing marker of an Object value (character '}'; plus possible white space decoration if pretty-printing is enabled). |
| public JsonGenerator | writeName(String name)
Implements abstract tools. Method for writing an Object Property name (JSON String surrounded by double quotes: syntactically identical to a JSON String value), possibly decorated by white space if pretty-printing is enabled. |
| public JsonGenerator | writeName(SerializableString sstr)
Overrides tools. Method similar to |
| public JsonGenerator | writeNull()
Implements abstract tools. Method for outputting literal JSON null value. |
| public JsonGenerator | writeNumber(short v)
Implements abstract tools. Method for outputting given value as JSON number. |
| public JsonGenerator | writeNumber(int v)
Implements abstract tools. Method for outputting given value as JSON number. |
| public JsonGenerator | writeNumber(long v)
Implements abstract tools. Method for outputting given value as JSON number. |
| public JsonGenerator | writeNumber(BigInteger v)
Implements abstract tools. Method for outputting given value as JSON number. |
| public JsonGenerator | writeNumber(double d)
Implements abstract tools. Method for outputting indicate JSON numeric value. |
| public JsonGenerator | writeNumber(float f)
Implements abstract tools. Method for outputting indicate JSON numeric value. |
| public JsonGenerator | writeNumber(BigDecimal v)
Implements abstract tools. Method for outputting indicate JSON numeric value. |
| public JsonGenerator | writeNumber(String encodedValue)
Implements abstract tools. Write method that can be used for custom numeric types that can not be (easily?) converted to "standard" Java number types. |
| public JsonGenerator | writePropertyId(long id)
Implements abstract tools. Alternative to |
| public JsonGenerator | writeRaw(String text)
Implements abstract tools. Method that will force generator to copy input text verbatim with no modifications (including that no escaping is done and no separators are added even if context [array, object] would otherwise require such). |
| public JsonGenerator | writeRaw(String text, int offset, int len)
Implements abstract tools. Method that will force generator to copy input text verbatim with no modifications (including that no escaping is done and no separators are added even if context [array, object] would otherwise require such). |
| public JsonGenerator | writeRaw(char[] text, int offset, int len)
Implements abstract tools. Method that will force generator to copy input text verbatim with no modifications (including that no escaping is done and no separators are added even if context [array, object] would otherwise require such). |
| public JsonGenerator | writeRaw(char c)
Implements abstract tools. Method that will force generator to copy input text verbatim with no modifications (including that no escaping is done and no separators are added even if context [array, object] would otherwise require such). |
| public JsonGenerator | writeRawUTF8String(byte[] text, int offset, int len)
Implements abstract tools. Method similar to |
| public JsonGenerator | writeRawValue(String text)
Overrides tools. Method that will force generator to copy input text verbatim without any modifications, but assuming it must constitute a single legal JSON value (number, string, boolean, null, Array or List). |
| public JsonGenerator | writeRawValue(String text, int offset, int len)
Overrides tools.
|
| public JsonGenerator | writeRawValue(char[] text, int offset, int len)
Overrides tools.
|
| public JsonGenerator | writeStartArray()
Implements abstract tools. Method for writing starting marker of a Array value (for JSON this is character '['; plus possible white space decoration if pretty-printing is enabled). |
| public JsonGenerator | writeStartArray(Object currValue)
Implements abstract tools. Method for writing start marker of an Array value, similar
to |
| public JsonGenerator | writeStartObject(Object currValue)
Implements abstract tools. Method for writing starting marker of an Object value to represent the given Java Object value. |
| public JsonGenerator | writeStartObject()
Implements abstract tools. Method for writing starting marker of an Object value (character '{'; plus possible white space decoration if pretty-printing is enabled). |
| public JsonGenerator | writeString(String text)
Implements abstract tools. Method for outputting a String value. |
| public JsonGenerator | writeString(char[] text, int offset, int clen)
Implements abstract tools. Method for outputting a String value. |
| public JsonGenerator | writeString(SerializableString sstr)
Overrides tools. Method similar to |
| public JsonGenerator | writeUTF8String(byte[] text, int offset, int len)
Implements abstract tools. Method similar to |