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 int
memoizedSerializedSize
-
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> void
addAll(java.lang.Iterable<T> values, java.util.Collection<? super T> list)
T
assertInitialized()
protected T
checktInitialized()
void
clear()
abstract T
clone()
protected static int
computeGroupSize(int tag, BaseMessage message)
protected static int
computeMessageSize(int tag, BaseMessage message)
private T
getThis()
boolean
isInitialized()
protected void
load()
protected void
loadAndClear()
T
mergeFramed(byte[] data)
T
mergeFramed(java.io.InputStream input)
T
mergeFramed(Buffer data)
T
mergeFramed(CodedInputStream input)
T
mergeFrom(T other)
T
mergeUnframed(byte[] data)
T
mergeUnframed(java.io.InputStream input)
T
mergeUnframed(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 byte
readRawByte(java.io.InputStream is)
static int
readRawVarint32(java.io.InputStream is)
Read a raw Varint from the stream.int
serializedSizeFramed()
Buffer
toFramedBuffer()
byte[]
toFramedByteArray()
Buffer
toUnframedBuffer()
byte[]
toUnframedByteArray()
void
writeFramed(java.io.OutputStream output)
void
writeFramed(CodedOutputStream output)
protected static void
writeGroup(CodedOutputStream output, int tag, BaseMessage message)
protected static void
writeMessage(CodedOutputStream output, int tag, BaseMessage message)
void
writeUnframed(java.io.OutputStream output)
void
writeUnframed(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:
assertInitialized
in 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:
writeUnframed
in interfaceMessage<T>
- Throws:
java.io.IOException
-
writeFramed
public void writeFramed(CodedOutputStream output) throws java.io.IOException
- Specified by:
writeFramed
in interfaceMessage<T>
- Throws:
java.io.IOException
-
toUnframedBuffer
public Buffer toUnframedBuffer()
- Specified by:
toUnframedBuffer
in interfaceMessage<T>
-
toFramedBuffer
public Buffer toFramedBuffer()
- Specified by:
toFramedBuffer
in interfaceMessage<T>
-
toUnframedByteArray
public byte[] toUnframedByteArray()
- Specified by:
toUnframedByteArray
in interfaceMessage<T>
-
toFramedByteArray
public byte[] toFramedByteArray()
- Specified by:
toFramedByteArray
in interfaceMessage<T>
-
writeFramed
public void writeFramed(java.io.OutputStream output) throws java.io.IOException
- Specified by:
writeFramed
in interfaceMessage<T>
- Throws:
java.io.IOException
-
writeUnframed
public void writeUnframed(java.io.OutputStream output) throws java.io.IOException
- Specified by:
writeUnframed
in interfaceMessage<T>
- Throws:
java.io.IOException
-
serializedSizeFramed
public int serializedSizeFramed()
- Specified by:
serializedSizeFramed
in interfaceMessage<T>
-
mergeFramed
public T mergeFramed(CodedInputStream input) throws java.io.IOException
- Specified by:
mergeFramed
in interfaceMessage<T>
- Throws:
java.io.IOException
-
mergeUnframed
public T mergeUnframed(Buffer data) throws InvalidProtocolBufferException
- Specified by:
mergeUnframed
in interfaceMessage<T>
- Throws:
InvalidProtocolBufferException
-
getThis
private T getThis()
-
mergeFramed
public T mergeFramed(Buffer data) throws InvalidProtocolBufferException
- Specified by:
mergeFramed
in interfaceMessage<T>
- Throws:
InvalidProtocolBufferException
-
mergeUnframed
public T mergeUnframed(byte[] data) throws InvalidProtocolBufferException
- Specified by:
mergeUnframed
in interfaceMessage<T>
- Throws:
InvalidProtocolBufferException
-
mergeFramed
public T mergeFramed(byte[] data) throws InvalidProtocolBufferException
- Specified by:
mergeFramed
in interfaceMessage<T>
- Throws:
InvalidProtocolBufferException
-
mergeUnframed
public T mergeUnframed(java.io.InputStream input) throws java.io.IOException
- Specified by:
mergeUnframed
in interfaceMessage<T>
- Throws:
java.io.IOException
-
mergeFramed
public T mergeFramed(java.io.InputStream input) throws java.io.IOException
- Specified by:
mergeFramed
in 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.IOException
Read 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
-
-