public class ProtobufGenerator
extends com.fasterxml.jackson.core.base.GeneratorBase
| 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
JsonToken.FIELD_NAME is written,
cleared once value has been written |
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 |
_currPtr |
protected int |
_currStart |
protected boolean |
_inObject |
protected com.fasterxml.jackson.core.io.IOContext |
_ioContext |
protected byte[] |
_origCurrBuffer
The first allocated (or recycled) buffer instance; needed to avoid
issue [dataformat-protobuf#14].
|
protected OutputStream |
_output
Ultimate destination
|
protected ProtobufWriteContext |
_pbContext
Current context, in form we can use it.
|
protected ProtobufWriteContext |
_rootContext
Reference to the root context since that is needed for serialization
|
protected ProtobufSchema |
_schema |
protected boolean |
_writeTag
Flag that indicates whether values should be written with tag or not;
false for packed arrays, true for others.
|
protected static com.fasterxml.jackson.core.json.JsonWriteContext |
BOGUS_WRITE_CONTEXT
Since our context object does NOT implement standard write context, need
to do something like use a placeholder...
|
protected static 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 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.
|
_cfgNumbersAsStrings, _closed, _features, _objectCodec, _writeContext, DERIVED_FEATURES_MASK, MAX_BIG_DECIMAL_SCALE, SURR1_FIRST, SURR1_LAST, SURR2_FIRST, SURR2_LAST, WRITE_BINARY, WRITE_BOOLEAN, WRITE_NULL, WRITE_NUMBER, WRITE_RAW, WRITE_STRING| Constructor and Description |
|---|
ProtobufGenerator(com.fasterxml.jackson.core.io.IOContext ctxt,
int jsonFeatures,
com.fasterxml.jackson.core.ObjectCodec codec,
OutputStream output) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_complete() |
protected void |
_encodeLongerString(char[] text,
int offset,
int clen) |
protected void |
_encodeLongerString(String text) |
protected void |
_ensureMore() |
protected void |
_ensureRoom(int needed) |
protected void |
_releaseBuffers() |
protected void |
_reportEnumError(Object enumValue) |
protected void |
_reportWrongWireType(String typeStr) |
protected void |
_verifyValueWrite() |
protected void |
_verifyValueWrite(String typeMsg) |
protected void |
_writeEmptyString() |
protected void |
_writeEnum(int index) |
protected void |
_writeEnum(String str) |
protected void |
_writeLengthPrefixed(byte[] data,
int offset,
int len) |
boolean |
canUseSchema(com.fasterxml.jackson.core.FormatSchema schema) |
boolean |
canWriteBinaryNatively() |
void |
close() |
void |
flush() |
Object |
getCurrentValue() |
int |
getOutputBuffered()
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.
|
Object |
getOutputTarget() |
ProtobufSchema |
getSchema() |
void |
setCurrentValue(Object v) |
ProtobufGenerator |
setPrettyPrinter(com.fasterxml.jackson.core.PrettyPrinter pp) |
void |
setSchema(com.fasterxml.jackson.core.FormatSchema schema) |
void |
setSchema(ProtobufSchema schema) |
ProtobufGenerator |
useDefaultPrettyPrinter()
Not sure whether to throw an exception or just do no-op; for now,
latter.
|
com.fasterxml.jackson.core.Version |
version() |
void |
writeArray(double[] array,
int offset,
int length) |
void |
writeArray(int[] array,
int offset,
int length) |
void |
writeArray(long[] array,
int offset,
int length) |
void |
writeBinary(com.fasterxml.jackson.core.Base64Variant b64variant,
byte[] data,
int offset,
int len) |
void |
writeBoolean(boolean state) |
void |
writeEndArray() |
void |
writeEndObject() |
void |
writeFieldName(com.fasterxml.jackson.core.SerializableString sstr) |
void |
writeFieldName(String name) |
void |
writeNull() |
void |
writeNumber(BigDecimal v) |
void |
writeNumber(BigInteger v) |
void |
writeNumber(double d) |
void |
writeNumber(float f) |
void |
writeNumber(int v) |
void |
writeNumber(long v) |
void |
writeNumber(String encodedValue) |
void |
writeRaw(char c) |
void |
writeRaw(char[] text,
int offset,
int len) |
void |
writeRaw(String text) |
void |
writeRaw(String text,
int offset,
int len) |
void |
writeRawUTF8String(byte[] text,
int offset,
int len) |
void |
writeRawValue(char[] text,
int offset,
int len) |
void |
writeRawValue(String text) |
void |
writeRawValue(String text,
int offset,
int len) |
void |
writeStartArray() |
void |
writeStartObject() |
void |
writeString(char[] text,
int offset,
int clen) |
void |
writeString(com.fasterxml.jackson.core.SerializableString sstr) |
void |
writeString(String text) |
void |
writeUTF8String(byte[] text,
int offset,
int len) |
_asString, _checkStdFeatureChanges, _constructDefaultPrettyPrinter, _decodeSurrogate, disable, enable, getCodec, getFeatureMask, getOutputContext, isClosed, isEnabled, overrideStdFeatures, setCodec, setFeatureMask, writeBinary, writeObject, writeRawValue, writeStartObject, writeTree_copyCurrentContents, _reportError, _reportUnsupportedOperation, _throwInternal, _verifyOffsets, _writeSimpleObject, canOmitFields, canWriteFormattedNumbers, canWriteObjectId, canWriteTypeId, configure, copyCurrentEvent, copyCurrentStructure, getCharacterEscapes, getFormatFeatures, getHighestEscapedChar, getPrettyPrinter, isEnabled, overrideFormatFeatures, setCharacterEscapes, setHighestNonEscapedChar, setRootValueSeparator, writeArray, writeArrayFieldStart, writeBinary, writeBinary, writeBinary, writeBinaryField, writeBooleanField, writeEmbeddedObject, writeFieldId, writeNullField, writeNumber, writeNumber, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeObjectField, writeObjectFieldStart, writeObjectId, writeObjectRef, writeOmittedField, writeRaw, writeStartArray, writeStartArray, writeStartArray, writeStartObject, writeString, writeStringField, writeTypeId, writeTypePrefix, writeTypeSuffixprotected static final com.fasterxml.jackson.core.json.JsonWriteContext BOGUS_WRITE_CONTEXT
protected static final ProtobufField UNKNOWN_FIELD
protected static final ProtobufMessage UNKNOWN_MESSAGE
protected final com.fasterxml.jackson.core.io.IOContext _ioContext
protected ProtobufSchema _schema
protected ProtobufWriteContext _rootContext
protected boolean _inObject
protected boolean _writeTag
protected boolean _complete
protected ProtobufMessage _currMessage
protected ProtobufField _currField
JsonToken.FIELD_NAME is written,
cleared once value has been writtenprotected final OutputStream _output
protected ByteAccumulator _buffered
protected ProtobufWriteContext _pbContext
protected byte[] _currBuffer
protected byte[] _origCurrBuffer
protected int _currStart
protected int _currPtr
public ProtobufGenerator(com.fasterxml.jackson.core.io.IOContext ctxt,
int jsonFeatures,
com.fasterxml.jackson.core.ObjectCodec codec,
OutputStream output)
throws IOException
IOExceptionpublic void setSchema(ProtobufSchema schema)
public Object getCurrentValue()
getCurrentValue in class com.fasterxml.jackson.core.base.GeneratorBasepublic void setCurrentValue(Object v)
setCurrentValue in class com.fasterxml.jackson.core.base.GeneratorBasepublic com.fasterxml.jackson.core.Version version()
version in interface com.fasterxml.jackson.core.Versionedversion in class com.fasterxml.jackson.core.base.GeneratorBasepublic boolean canWriteBinaryNatively()
canWriteBinaryNatively in class com.fasterxml.jackson.core.JsonGeneratorpublic boolean canUseSchema(com.fasterxml.jackson.core.FormatSchema schema)
canUseSchema in class com.fasterxml.jackson.core.JsonGeneratorpublic ProtobufGenerator useDefaultPrettyPrinter()
useDefaultPrettyPrinter in class com.fasterxml.jackson.core.base.GeneratorBasepublic ProtobufGenerator setPrettyPrinter(com.fasterxml.jackson.core.PrettyPrinter pp)
setPrettyPrinter in class com.fasterxml.jackson.core.JsonGeneratorpublic Object getOutputTarget()
getOutputTarget in class com.fasterxml.jackson.core.JsonGeneratorpublic int getOutputBuffered()
getOutputBuffered in class com.fasterxml.jackson.core.JsonGeneratorpublic ProtobufSchema getSchema()
getSchema in class com.fasterxml.jackson.core.JsonGeneratorpublic void setSchema(com.fasterxml.jackson.core.FormatSchema schema)
setSchema in class com.fasterxml.jackson.core.JsonGeneratorpublic final void writeFieldName(String name) throws IOException
writeFieldName in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic final void writeFieldName(com.fasterxml.jackson.core.SerializableString sstr)
throws IOException
writeFieldName in class com.fasterxml.jackson.core.base.GeneratorBaseIOExceptionpublic final void flush()
throws IOException
flush in interface Flushableflush in class com.fasterxml.jackson.core.base.GeneratorBaseIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class com.fasterxml.jackson.core.base.GeneratorBaseIOExceptionpublic final void writeStartArray()
throws IOException
writeStartArray in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic final void writeEndArray()
throws IOException
writeEndArray in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic final void writeStartObject()
throws IOException
writeStartObject in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic final void writeEndObject()
throws IOException
writeEndObject in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeArray(int[] array,
int offset,
int length)
throws IOException
writeArray in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeArray(long[] array,
int offset,
int length)
throws IOException
writeArray in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeArray(double[] array,
int offset,
int length)
throws IOException
writeArray in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeString(String text) throws IOException
writeString in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeString(char[] text,
int offset,
int clen)
throws IOException
writeString in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic final void writeString(com.fasterxml.jackson.core.SerializableString sstr)
throws IOException
writeString in class com.fasterxml.jackson.core.base.GeneratorBaseIOExceptionpublic void writeRawUTF8String(byte[] text,
int offset,
int len)
throws IOException
writeRawUTF8String in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic final void writeUTF8String(byte[] text,
int offset,
int len)
throws IOException
writeUTF8String in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionprotected void _writeEmptyString()
throws IOException
IOExceptionprotected void _writeEnum(String str) throws IOException
IOExceptionprotected void _writeEnum(int index)
throws IOException
IOExceptionprotected void _reportEnumError(Object enumValue) throws IOException
IOExceptionpublic void writeRaw(String text) throws IOException
writeRaw in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeRaw(String text, int offset, int len) throws IOException
writeRaw in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeRaw(char[] text,
int offset,
int len)
throws IOException
writeRaw in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeRaw(char c)
throws IOException
writeRaw in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeRawValue(String text) throws IOException
writeRawValue in class com.fasterxml.jackson.core.base.GeneratorBaseIOExceptionpublic void writeRawValue(String text, int offset, int len) throws IOException
writeRawValue in class com.fasterxml.jackson.core.base.GeneratorBaseIOExceptionpublic void writeRawValue(char[] text,
int offset,
int len)
throws IOException
writeRawValue in class com.fasterxml.jackson.core.base.GeneratorBaseIOExceptionpublic void writeBinary(com.fasterxml.jackson.core.Base64Variant b64variant,
byte[] data,
int offset,
int len)
throws IOException
writeBinary in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeBoolean(boolean state)
throws IOException
writeBoolean in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeNull()
throws IOException
writeNull in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeNumber(int v)
throws IOException
writeNumber in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeNumber(long v)
throws IOException
writeNumber in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeNumber(BigInteger v) throws IOException
writeNumber in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeNumber(double d)
throws IOException
writeNumber in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeNumber(float f)
throws IOException
writeNumber in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeNumber(BigDecimal v) throws IOException
writeNumber in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionpublic void writeNumber(String encodedValue) throws IOException
writeNumber in class com.fasterxml.jackson.core.JsonGeneratorIOExceptionprotected final void _verifyValueWrite()
throws IOException
IOExceptionprotected void _verifyValueWrite(String typeMsg) throws IOException
_verifyValueWrite in class com.fasterxml.jackson.core.base.GeneratorBaseIOExceptionprotected void _releaseBuffers()
_releaseBuffers in class com.fasterxml.jackson.core.base.GeneratorBaseprotected void _encodeLongerString(char[] text,
int offset,
int clen)
throws IOException
IOExceptionprotected void _encodeLongerString(String text) throws IOException
IOExceptionprotected void _writeLengthPrefixed(byte[] data,
int offset,
int len)
throws IOException
IOExceptionprotected final void _ensureRoom(int needed)
throws IOException
IOExceptionprotected final void _ensureMore()
throws IOException
IOExceptionprotected void _complete()
throws IOException
IOExceptionprotected void _reportWrongWireType(String typeStr) throws IOException
IOExceptionCopyright © 2020 FasterXML. All rights reserved.