Package org.fusesource.hawtbuf.proto
Class BaseMessage<T>
- java.lang.Object
-
- org.fusesource.hawtbuf.proto.BaseMessage<T>
-
- All Implemented Interfaces:
Message<T>
- Direct Known Subclasses:
DeferredDecodeMessage
public abstract class BaseMessage<T> extends java.lang.Object implements Message<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected intmemoizedSerializedSize
-
Constructor Summary
Constructors Constructor Description BaseMessage()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static <T> voidaddAll(java.lang.Iterable<T> values, java.util.Collection<? super T> list)TassertInitialized()protected TchecktInitialized()voidclear()abstract Tclone()protected static intcomputeGroupSize(int tag, BaseMessage message)protected static intcomputeMessageSize(int tag, BaseMessage message)private TgetThis()booleanisInitialized()protected voidload()protected voidloadAndClear()TmergeFramed(byte[] data)TmergeFramed(java.io.InputStream input)TmergeFramed(Buffer data)TmergeFramed(CodedInputStream input)TmergeFrom(T other)TmergeUnframed(byte[] data)TmergeUnframed(java.io.InputStream input)TmergeUnframed(Buffer data)java.util.ArrayList<java.lang.String>missingFields()protected java.util.List<java.lang.String>prefix(java.util.List<java.lang.String> missingFields, java.lang.String prefix)protected static <T extends BaseMessage>
TreadGroup(CodedInputStream input, int tag, T group)protected static bytereadRawByte(java.io.InputStream is)static intreadRawVarint32(java.io.InputStream is)Read a raw Varint from the stream.intserializedSizeFramed()BuffertoFramedBuffer()byte[]toFramedByteArray()BuffertoUnframedBuffer()byte[]toUnframedByteArray()voidwriteFramed(java.io.OutputStream output)voidwriteFramed(CodedOutputStream output)protected static voidwriteGroup(CodedOutputStream output, int tag, BaseMessage message)protected static voidwriteMessage(CodedOutputStream output, int tag, BaseMessage message)voidwriteUnframed(java.io.OutputStream output)voidwriteUnframed(CodedOutputStream output)-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.fusesource.hawtbuf.proto.Message
mergeUnframed, serializedSizeUnframed
-
-
-
-
Method Detail
-
clone
public abstract T clone() throws java.lang.CloneNotSupportedException
-
isInitialized
public boolean isInitialized()
-
assertInitialized
public T assertInitialized() throws UninitializedMessageException
- Specified by:
assertInitializedin interfaceMessage<T>- Throws:
UninitializedMessageException
-
checktInitialized
protected T checktInitialized() throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
missingFields
public java.util.ArrayList<java.lang.String> missingFields()
-
loadAndClear
protected void loadAndClear()
-
load
protected void load()
-
writeUnframed
public void writeUnframed(CodedOutputStream output) throws java.io.IOException
- Specified by:
writeUnframedin interfaceMessage<T>- Throws:
java.io.IOException
-
writeFramed
public void writeFramed(CodedOutputStream output) throws java.io.IOException
- Specified by:
writeFramedin interfaceMessage<T>- Throws:
java.io.IOException
-
toUnframedBuffer
public Buffer toUnframedBuffer()
- Specified by:
toUnframedBufferin interfaceMessage<T>
-
toFramedBuffer
public Buffer toFramedBuffer()
- Specified by:
toFramedBufferin interfaceMessage<T>
-
toUnframedByteArray
public byte[] toUnframedByteArray()
- Specified by:
toUnframedByteArrayin interfaceMessage<T>
-
toFramedByteArray
public byte[] toFramedByteArray()
- Specified by:
toFramedByteArrayin interfaceMessage<T>
-
writeFramed
public void writeFramed(java.io.OutputStream output) throws java.io.IOException- Specified by:
writeFramedin interfaceMessage<T>- Throws:
java.io.IOException
-
writeUnframed
public void writeUnframed(java.io.OutputStream output) throws java.io.IOException- Specified by:
writeUnframedin interfaceMessage<T>- Throws:
java.io.IOException
-
serializedSizeFramed
public int serializedSizeFramed()
- Specified by:
serializedSizeFramedin interfaceMessage<T>
-
mergeFramed
public T mergeFramed(CodedInputStream input) throws java.io.IOException
- Specified by:
mergeFramedin interfaceMessage<T>- Throws:
java.io.IOException
-
mergeUnframed
public T mergeUnframed(Buffer data) throws InvalidProtocolBufferException
- Specified by:
mergeUnframedin interfaceMessage<T>- Throws:
InvalidProtocolBufferException
-
getThis
private T getThis()
-
mergeFramed
public T mergeFramed(Buffer data) throws InvalidProtocolBufferException
- Specified by:
mergeFramedin interfaceMessage<T>- Throws:
InvalidProtocolBufferException
-
mergeUnframed
public T mergeUnframed(byte[] data) throws InvalidProtocolBufferException
- Specified by:
mergeUnframedin interfaceMessage<T>- Throws:
InvalidProtocolBufferException
-
mergeFramed
public T mergeFramed(byte[] data) throws InvalidProtocolBufferException
- Specified by:
mergeFramedin interfaceMessage<T>- Throws:
InvalidProtocolBufferException
-
mergeUnframed
public T mergeUnframed(java.io.InputStream input) throws java.io.IOException
- Specified by:
mergeUnframedin interfaceMessage<T>- Throws:
java.io.IOException
-
mergeFramed
public T mergeFramed(java.io.InputStream input) throws java.io.IOException
- Specified by:
mergeFramedin interfaceMessage<T>- Throws:
java.io.IOException
-
addAll
protected static <T> void addAll(java.lang.Iterable<T> values, java.util.Collection<? super T> list)
-
writeGroup
protected static void writeGroup(CodedOutputStream output, int tag, BaseMessage message) throws java.io.IOException
- Throws:
java.io.IOException
-
readGroup
protected static <T extends BaseMessage> T readGroup(CodedInputStream input, int tag, T group) throws java.io.IOException
- Throws:
java.io.IOException
-
computeGroupSize
protected static int computeGroupSize(int tag, BaseMessage message)
-
writeMessage
protected static void writeMessage(CodedOutputStream output, int tag, BaseMessage message) throws java.io.IOException
- Throws:
java.io.IOException
-
computeMessageSize
protected static int computeMessageSize(int tag, BaseMessage message)
-
prefix
protected java.util.List<java.lang.String> prefix(java.util.List<java.lang.String> missingFields, java.lang.String prefix)
-
readRawVarint32
public static int readRawVarint32(java.io.InputStream is) throws java.io.IOExceptionRead a raw Varint from the stream. If larger than 32 bits, discard the upper bits.- Throws:
java.io.IOException
-
readRawByte
protected static byte readRawByte(java.io.InputStream is) throws java.io.IOException- Throws:
java.io.IOException
-
-