|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.protobuf.AbstractMessageLite
public abstract class AbstractMessageLite
A partial implementation of the MessageLite
interface which
implements as many methods of that interface as possible in terms of other
methods.
Nested Class Summary | |
---|---|
static class |
AbstractMessageLite.Builder<BuilderType extends AbstractMessageLite.Builder>
A partial implementation of the Message.Builder interface which
implements as many methods of that interface as possible in terms of
other methods. |
Constructor Summary | |
---|---|
AbstractMessageLite()
|
Method Summary | |
---|---|
byte[] |
toByteArray()
Serializes the message to a byte array and returns it. |
ByteString |
toByteString()
Serializes the message to a ByteString and returns it. |
void |
writeDelimitedTo(java.io.OutputStream output)
Like MessageLite.writeTo(OutputStream) , but writes the size of the message
as a varint before writing the data. |
void |
writeTo(java.io.OutputStream output)
Serializes the message and writes it to output . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.google.protobuf.MessageLite |
---|
getDefaultInstanceForType, getSerializedSize, isInitialized, newBuilderForType, toBuilder, writeTo |
Constructor Detail |
---|
public AbstractMessageLite()
Method Detail |
---|
public ByteString toByteString()
MessageLite
ByteString
and returns it. This is
just a trivial wrapper around
MessageLite.writeTo(CodedOutputStream)
.
toByteString
in interface MessageLite
public byte[] toByteArray()
MessageLite
byte
array and returns it. This is
just a trivial wrapper around
MessageLite.writeTo(CodedOutputStream)
.
toByteArray
in interface MessageLite
public void writeTo(java.io.OutputStream output) throws java.io.IOException
MessageLite
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)
.
writeTo
in interface MessageLite
java.io.IOException
public void writeDelimitedTo(java.io.OutputStream output) throws java.io.IOException
MessageLite
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.
writeDelimitedTo
in interface MessageLite
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |