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.
|
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) |
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) |
_checkStdFeatureChanges, _constructDefaultPrettyPrinter, _decodeSurrogate, disable, enable, getCodec, getFeatureMask, getOutputContext, isClosed, isEnabled, overrideStdFeatures, setCodec, setFeatureMask, writeBinary, writeObject, writeRawValue, writeStartObject, writeTree
_reportError, _reportUnsupportedOperation, _throwInternal, _verifyOffsets, _writeSimpleObject, canOmitFields, canWriteBinaryNatively, canWriteFormattedNumbers, canWriteObjectId, canWriteTypeId, configure, copyCurrentEvent, copyCurrentStructure, getCharacterEscapes, getFormatFeatures, getHighestEscapedChar, getPrettyPrinter, overrideFormatFeatures, setCharacterEscapes, setHighestNonEscapedChar, setRootValueSeparator, writeArrayFieldStart, writeBinary, writeBinary, writeBinary, writeBinaryField, writeBooleanField, writeEmbeddedObject, writeFieldId, writeNullField, writeNumber, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeObjectField, writeObjectFieldStart, writeObjectId, writeObjectRef, writeOmittedField, writeRaw, writeStartArray, writeStringField, writeTypeId
protected 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
IOException
public void setSchema(ProtobufSchema schema)
public Object getCurrentValue()
getCurrentValue
in class com.fasterxml.jackson.core.base.GeneratorBase
public void setCurrentValue(Object v)
setCurrentValue
in class com.fasterxml.jackson.core.base.GeneratorBase
public com.fasterxml.jackson.core.Version version()
version
in interface com.fasterxml.jackson.core.Versioned
version
in class com.fasterxml.jackson.core.base.GeneratorBase
public ProtobufGenerator useDefaultPrettyPrinter()
useDefaultPrettyPrinter
in class com.fasterxml.jackson.core.base.GeneratorBase
public ProtobufGenerator setPrettyPrinter(com.fasterxml.jackson.core.PrettyPrinter pp)
setPrettyPrinter
in class com.fasterxml.jackson.core.JsonGenerator
public Object getOutputTarget()
getOutputTarget
in class com.fasterxml.jackson.core.JsonGenerator
public int getOutputBuffered()
getOutputBuffered
in class com.fasterxml.jackson.core.JsonGenerator
public boolean canUseSchema(com.fasterxml.jackson.core.FormatSchema schema)
canUseSchema
in class com.fasterxml.jackson.core.JsonGenerator
public ProtobufSchema getSchema()
getSchema
in class com.fasterxml.jackson.core.JsonGenerator
public void setSchema(com.fasterxml.jackson.core.FormatSchema schema)
setSchema
in class com.fasterxml.jackson.core.JsonGenerator
public final void writeFieldName(String name) throws IOException
writeFieldName
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public final void writeFieldName(com.fasterxml.jackson.core.SerializableString sstr) throws IOException
writeFieldName
in class com.fasterxml.jackson.core.base.GeneratorBase
IOException
public final void flush() throws IOException
flush
in interface Flushable
flush
in class com.fasterxml.jackson.core.base.GeneratorBase
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class com.fasterxml.jackson.core.base.GeneratorBase
IOException
public final void writeStartArray() throws IOException
writeStartArray
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public final void writeEndArray() throws IOException
writeEndArray
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public final void writeStartObject() throws IOException
writeStartObject
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public final void writeEndObject() throws IOException
writeEndObject
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeArray(int[] array, int offset, int length) throws IOException
writeArray
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeArray(long[] array, int offset, int length) throws IOException
writeArray
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeArray(double[] array, int offset, int length) throws IOException
writeArray
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeString(String text) throws IOException
writeString
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeString(char[] text, int offset, int clen) throws IOException
writeString
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public final void writeString(com.fasterxml.jackson.core.SerializableString sstr) throws IOException
writeString
in class com.fasterxml.jackson.core.base.GeneratorBase
IOException
public void writeRawUTF8String(byte[] text, int offset, int len) throws IOException
writeRawUTF8String
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public final void writeUTF8String(byte[] text, int offset, int len) throws IOException
writeUTF8String
in class com.fasterxml.jackson.core.JsonGenerator
IOException
protected void _writeEmptyString() throws IOException
IOException
protected void _writeEnum(String str) throws IOException
IOException
protected void _writeEnum(int index) throws IOException
IOException
protected void _reportEnumError(Object enumValue) throws IOException
IOException
public void writeRaw(String text) throws IOException
writeRaw
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeRaw(String text, int offset, int len) throws IOException
writeRaw
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeRaw(char[] text, int offset, int len) throws IOException
writeRaw
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeRaw(char c) throws IOException
writeRaw
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeRawValue(String text) throws IOException
writeRawValue
in class com.fasterxml.jackson.core.base.GeneratorBase
IOException
public void writeRawValue(String text, int offset, int len) throws IOException
writeRawValue
in class com.fasterxml.jackson.core.base.GeneratorBase
IOException
public void writeRawValue(char[] text, int offset, int len) throws IOException
writeRawValue
in class com.fasterxml.jackson.core.base.GeneratorBase
IOException
public void writeBinary(com.fasterxml.jackson.core.Base64Variant b64variant, byte[] data, int offset, int len) throws IOException
writeBinary
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeBoolean(boolean state) throws IOException
writeBoolean
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeNull() throws IOException
writeNull
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeNumber(int v) throws IOException
writeNumber
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeNumber(long v) throws IOException
writeNumber
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeNumber(BigInteger v) throws IOException
writeNumber
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeNumber(double d) throws IOException
writeNumber
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeNumber(float f) throws IOException
writeNumber
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeNumber(BigDecimal v) throws IOException
writeNumber
in class com.fasterxml.jackson.core.JsonGenerator
IOException
public void writeNumber(String encodedValue) throws IOException
writeNumber
in class com.fasterxml.jackson.core.JsonGenerator
IOException
protected final void _verifyValueWrite() throws IOException
IOException
protected void _verifyValueWrite(String typeMsg) throws IOException
_verifyValueWrite
in class com.fasterxml.jackson.core.base.GeneratorBase
IOException
protected void _releaseBuffers()
_releaseBuffers
in class com.fasterxml.jackson.core.base.GeneratorBase
protected void _encodeLongerString(char[] text, int offset, int clen) throws IOException
IOException
protected void _encodeLongerString(String text) throws IOException
IOException
protected void _writeLengthPrefixed(byte[] data, int offset, int len) throws IOException
IOException
protected final void _ensureRoom(int needed) throws IOException
IOException
protected final void _ensureMore() throws IOException
IOException
protected void _complete() throws IOException
IOException
protected void _reportWrongWireType(String typeStr) throws IOException
IOException
Copyright © 2016 FasterXML. All rights reserved.