private class ProtobufDecoder.MessageDecoderFunction extends java.lang.Object implements java.util.function.Function<DataBuffer,java.lang.Iterable<? extends Message>>
Modifier and Type | Field and Description |
---|---|
private ResolvableType |
elementType |
private int |
maxMessageSize |
private int |
messageBytesToRead |
private int |
offset |
private DataBuffer |
output |
Constructor and Description |
---|
MessageDecoderFunction(ResolvableType elementType,
int maxMessageSize) |
Modifier and Type | Method and Description |
---|---|
java.lang.Iterable<? extends Message> |
apply(DataBuffer input) |
void |
discard() |
private boolean |
readMessageSize(DataBuffer input)
Parse message size as a varint from the input stream, updating
messageBytesToRead and
offset fields if needed to allow processing of upcoming chunks. |
private final ResolvableType elementType
private final int maxMessageSize
@Nullable private DataBuffer output
private int messageBytesToRead
private int offset
public MessageDecoderFunction(ResolvableType elementType, int maxMessageSize)
public java.lang.Iterable<? extends Message> apply(DataBuffer input)
apply
in interface java.util.function.Function<DataBuffer,java.lang.Iterable<? extends Message>>
private boolean readMessageSize(DataBuffer input)
messageBytesToRead
and
offset
fields if needed to allow processing of upcoming chunks.
Inspired from CodedInputStream#readRawVarint32(int, java.io.InputStream)
public void discard()