Package akka.protobuf

Class AbstractMessageLite

    • Constructor Detail

      • AbstractMessageLite

        public AbstractMessageLite()
    • Method Detail

      • writeTo

        public void writeTo​(java.io.OutputStream output)
                     throws java.io.IOException
        Description copied from interface: MessageLite
        Serializes the message and writes it to output. This is just a trivial wrapper around MessageLite.writeTo(CodedOutputStream). This does not flush or close the stream.

        NOTE: Protocol Buffers are not self-delimiting. Therefore, if you write any more data to the stream after the message, you must somehow ensure that the parser on the receiving end does not interpret this as being part of the protocol message. This can be done e.g. by writing the size of the message before the data, then making sure to limit the input to that size on the receiving end (e.g. by wrapping the InputStream in one which limits the input). Alternatively, just use MessageLite.writeDelimitedTo(OutputStream).

        Specified by:
        writeTo in interface MessageLite
        Throws:
        java.io.IOException
      • writeDelimitedTo

        public void writeDelimitedTo​(java.io.OutputStream output)
                              throws java.io.IOException
        Description copied from interface: MessageLite
        Like MessageLite.writeTo(OutputStream), but writes the size of the message as a varint before writing the data. This allows more data to be written to the stream after the message without the need to delimit the message data yourself. Use MessageLite.Builder.mergeDelimitedFrom(InputStream) (or the static method YourMessageType.parseDelimitedFrom(InputStream)) to parse messages written by this method.
        Specified by:
        writeDelimitedTo in interface MessageLite
        Throws:
        java.io.IOException