Package akka.protobuf
Class AbstractMessageLite
- java.lang.Object
-
- akka.protobuf.AbstractMessageLite
-
- All Implemented Interfaces:
MessageLite,MessageLiteOrBuilder
- Direct Known Subclasses:
AbstractMessage,GeneratedMessageLite
public abstract class AbstractMessageLite extends java.lang.Object implements MessageLite
A partial implementation of theMessageLiteinterface which implements as many methods of that interface as possible in terms of other methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractMessageLite.Builder<BuilderType extends AbstractMessageLite.Builder>A partial implementation of theMessage.Builderinterface which implements as many methods of that interface as possible in terms of other methods.
-
Constructor Summary
Constructors Constructor Description AbstractMessageLite()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]toByteArray()Serializes the message to abytearray and returns it.ByteStringtoByteString()Serializes the message to aByteStringand returns it.voidwriteDelimitedTo(java.io.OutputStream output)LikeMessageLite.writeTo(OutputStream), but writes the size of the message as a varint before writing the data.voidwriteTo(java.io.OutputStream output)Serializes the message and writes it tooutput.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.protobuf.MessageLite
getParserForType, getSerializedSize, newBuilderForType, toBuilder, writeTo
-
Methods inherited from interface akka.protobuf.MessageLiteOrBuilder
getDefaultInstanceForType, isInitialized
-
-
-
-
Method Detail
-
toByteString
public ByteString toByteString()
Description copied from interface:MessageLiteSerializes the message to aByteStringand returns it. This is just a trivial wrapper aroundMessageLite.writeTo(CodedOutputStream).- Specified by:
toByteStringin interfaceMessageLite
-
toByteArray
public byte[] toByteArray()
Description copied from interface:MessageLiteSerializes the message to abytearray and returns it. This is just a trivial wrapper aroundMessageLite.writeTo(CodedOutputStream).- Specified by:
toByteArrayin interfaceMessageLite
-
writeTo
public void writeTo(java.io.OutputStream output) throws java.io.IOExceptionDescription copied from interface:MessageLiteSerializes the message and writes it tooutput. This is just a trivial wrapper aroundMessageLite.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:
writeToin interfaceMessageLite- Throws:
java.io.IOException
-
writeDelimitedTo
public void writeDelimitedTo(java.io.OutputStream output) throws java.io.IOExceptionDescription copied from interface:MessageLiteLikeMessageLite.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. UseMessageLite.Builder.mergeDelimitedFrom(InputStream)(or the static methodYourMessageType.parseDelimitedFrom(InputStream)) to parse messages written by this method.- Specified by:
writeDelimitedToin interfaceMessageLite- Throws:
java.io.IOException
-
-