Class InternalLazyField


  • class InternalLazyField
    extends java.lang.Object
    InternalLazyField encapsulates the logic of lazily parsing message fields. It stores the message in a ByteString initially and then parses it on-demand.

    The invariants of InternalLazyField are that 1) once value or bytes is set, they will not be changed; 2) value and bytes cannot be null at the same time; 3) If corrupted is true, value must be null.

    • Constructor Detail

      • InternalLazyField

        InternalLazyField​(MessageLite message)
        Constructor for InternalLazyField that takes in a message value. The argument cannot be null.
    • Method Detail

      • mergeFrom

        static InternalLazyField mergeFrom​(InternalLazyField lazyField,
                                           CodedInputStream input,
                                           ExtensionRegistryLite extensionRegistry)
                                    throws java.io.IOException
        Merges the InternalLazyField from the given CodedInputStream with the given extension registry.

        Precondition: the input stream should have already read the tag and be expected to read the size of the bytes next.

        Throws:
        java.io.IOException - only if an error occurs while reading the raw bytes from the input stream, not for failures in parsing the read bytes.
        InvalidProtobufRuntimeException - if the lazy field is corrupted and cannot be merged with a different extension registry.
      • hasBytes

        private boolean hasBytes()
      • isEmpty

        private boolean isEmpty()
      • getSerializedSize

        int getSerializedSize()
      • computeSizeNoTag

        int computeSizeNoTag()
      • computeSize

        int computeSize​(int fieldNumber)
      • computeMessageSetExtensionSize

        int computeMessageSetExtensionSize​(int fieldNumber)
      • writeTo

        void writeTo​(CodedOutputStreamWriter writer,
                     int fieldNumber)
              throws java.io.IOException
        Throws:
        java.io.IOException
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object