Class JsonSerializer

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    final class JsonSerializer
    extends Serializer
    • Field Detail

      • JSON_FACTORY

        private static final com.fasterxml.jackson.core.JsonFactory JSON_FACTORY
      • generator

        private final com.fasterxml.jackson.core.JsonGenerator generator
    • Constructor Detail

      • JsonSerializer

        JsonSerializer​(java.io.OutputStream output)
                throws java.io.IOException
        Throws:
        java.io.IOException
      • JsonSerializer

        JsonSerializer​(com.fasterxml.jackson.core.JsonGenerator generator)
    • Method Detail

      • writeTraceId

        protected void writeTraceId​(ProtoFieldInfo field,
                                    java.lang.String traceId)
                             throws java.io.IOException
        Specified by:
        writeTraceId in class Serializer
        Throws:
        java.io.IOException
      • writeSpanId

        protected void writeSpanId​(ProtoFieldInfo field,
                                   java.lang.String spanId)
                            throws java.io.IOException
        Specified by:
        writeSpanId in class Serializer
        Throws:
        java.io.IOException
      • writeBool

        public void writeBool​(ProtoFieldInfo field,
                              boolean value)
                       throws java.io.IOException
        Description copied from class: Serializer
        Writes a protobuf bool field, even if it matches the default value.
        Specified by:
        writeBool in class Serializer
        Throws:
        java.io.IOException
      • writeUint32

        protected void writeUint32​(ProtoFieldInfo field,
                                   int value)
                            throws java.io.IOException
        Specified by:
        writeUint32 in class Serializer
        Throws:
        java.io.IOException
      • writeSInt32

        protected void writeSInt32​(ProtoFieldInfo field,
                                   int value)
                            throws java.io.IOException
        Specified by:
        writeSInt32 in class Serializer
        Throws:
        java.io.IOException
      • writeint32

        protected void writeint32​(ProtoFieldInfo field,
                                  int value)
                           throws java.io.IOException
        Specified by:
        writeint32 in class Serializer
        Throws:
        java.io.IOException
      • writeInt64

        public void writeInt64​(ProtoFieldInfo field,
                               long value)
                        throws java.io.IOException
        Description copied from class: Serializer
        Writes a protobuf int64 field, even if it matches the default value.
        Specified by:
        writeInt64 in class Serializer
        Throws:
        java.io.IOException
      • writeFixed64

        protected void writeFixed64​(ProtoFieldInfo field,
                                    long value)
                             throws java.io.IOException
        Specified by:
        writeFixed64 in class Serializer
        Throws:
        java.io.IOException
      • writeFixed64Value

        protected void writeFixed64Value​(long value)
                                  throws java.io.IOException
        Specified by:
        writeFixed64Value in class Serializer
        Throws:
        java.io.IOException
      • writeUInt64Value

        protected void writeUInt64Value​(long value)
                                 throws java.io.IOException
        Specified by:
        writeUInt64Value in class Serializer
        Throws:
        java.io.IOException
      • writeUInt64

        public void writeUInt64​(ProtoFieldInfo field,
                                long value)
                         throws java.io.IOException
        Description copied from class: Serializer
        Writes a protobuf uint64 field, even if it matches the default value.
        Specified by:
        writeUInt64 in class Serializer
        Throws:
        java.io.IOException
      • writeFixed32

        protected void writeFixed32​(ProtoFieldInfo field,
                                    int value)
                             throws java.io.IOException
        Specified by:
        writeFixed32 in class Serializer
        Throws:
        java.io.IOException
      • writeDouble

        public void writeDouble​(ProtoFieldInfo field,
                                double value)
                         throws java.io.IOException
        Description copied from class: Serializer
        Writes a protobuf double field, even if it matches the default value.
        Specified by:
        writeDouble in class Serializer
        Throws:
        java.io.IOException
      • writeDoubleValue

        protected void writeDoubleValue​(double value)
                                 throws java.io.IOException
        Specified by:
        writeDoubleValue in class Serializer
        Throws:
        java.io.IOException
      • writeString

        public void writeString​(ProtoFieldInfo field,
                                byte[] utf8Bytes)
                         throws java.io.IOException
        Description copied from class: Serializer
        Writes a protobuf string field, even if it matches the default value.
        Specified by:
        writeString in class Serializer
        Throws:
        java.io.IOException
      • writeBytes

        public void writeBytes​(ProtoFieldInfo field,
                               byte[] value)
                        throws java.io.IOException
        Specified by:
        writeBytes in class Serializer
        Throws:
        java.io.IOException
      • writeByteBuffer

        public void writeByteBuffer​(ProtoFieldInfo field,
                                    java.nio.ByteBuffer value)
                             throws java.io.IOException
        Specified by:
        writeByteBuffer in class Serializer
        Throws:
        java.io.IOException
      • writeStartMessage

        protected void writeStartMessage​(ProtoFieldInfo field,
                                         int protoMessageSize)
                                  throws java.io.IOException
        Specified by:
        writeStartMessage in class Serializer
        Throws:
        java.io.IOException
      • writeEndMessage

        protected void writeEndMessage()
                                throws java.io.IOException
        Specified by:
        writeEndMessage in class Serializer
        Throws:
        java.io.IOException
      • writeStartRepeatedPrimitive

        protected void writeStartRepeatedPrimitive​(ProtoFieldInfo field,
                                                   int protoSizePerElement,
                                                   int numElements)
                                            throws java.io.IOException
        Specified by:
        writeStartRepeatedPrimitive in class Serializer
        Throws:
        java.io.IOException
      • writeEndRepeatedPrimitive

        protected void writeEndRepeatedPrimitive()
                                          throws java.io.IOException
        Specified by:
        writeEndRepeatedPrimitive in class Serializer
        Throws:
        java.io.IOException
      • writeEndRepeatedVarint

        protected void writeEndRepeatedVarint()
                                       throws java.io.IOException
        Specified by:
        writeEndRepeatedVarint in class Serializer
        Throws:
        java.io.IOException
      • serializeRepeatedMessage

        public void serializeRepeatedMessage​(ProtoFieldInfo field,
                                             java.util.List<? extends Marshaler> repeatedMessage)
                                      throws java.io.IOException
        Description copied from class: Serializer
        Serializes repeated message field.
        Specified by:
        serializeRepeatedMessage in class Serializer
        Throws:
        java.io.IOException
      • writeStartRepeated

        protected void writeStartRepeated​(ProtoFieldInfo field)
                                   throws java.io.IOException
        Description copied from class: Serializer
        Writes start of repeated messages.
        Specified by:
        writeStartRepeated in class Serializer
        Throws:
        java.io.IOException
      • writeEndRepeated

        protected void writeEndRepeated()
                                 throws java.io.IOException
        Description copied from class: Serializer
        Writes end of repeated messages.
        Specified by:
        writeEndRepeated in class Serializer
        Throws:
        java.io.IOException
      • writeStartRepeatedElement

        protected void writeStartRepeatedElement​(ProtoFieldInfo field,
                                                 int protoMessageSize)
                                          throws java.io.IOException
        Description copied from class: Serializer
        Writes start of a repeated message element.
        Specified by:
        writeStartRepeatedElement in class Serializer
        Throws:
        java.io.IOException
      • writeEndRepeatedElement

        protected void writeEndRepeatedElement()
                                        throws java.io.IOException
        Description copied from class: Serializer
        Writes end of a repeated message element.
        Specified by:
        writeEndRepeatedElement in class Serializer
        Throws:
        java.io.IOException
      • writeMessageValue

        void writeMessageValue​(Marshaler message)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeSerializedMessage

        public void writeSerializedMessage​(byte[] protoSerialized,
                                           java.lang.String jsonSerialized)
                                    throws java.io.IOException
        Description copied from class: Serializer
        Writes the value for a message field that has been pre-serialized.
        Specified by:
        writeSerializedMessage in class Serializer
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in class Serializer
        Throws:
        java.io.IOException